Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-3490

Custom exception handling

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • N/A

    • N/A

      I am developing a large plugin, planned for use in a single server with multiple developers. For multiple reasons I want to use a custom exception handler to "notify" developers of bugs rather than having them check the console all the time.

      I have seen a number of threads suggesting this:

      The replies point to solutions that don't work in my case:

      • Surrounding each problematic code section with a try/catch: My plugin is too large to do this for every event handler.
      • Just keeping them in the console as exceptions "are not meant to be ignored": I'm not ignoring them, I'm just doing something other than sending them to the console.

      This could be added by creating a ThrowableHandler interface with a single method

      void handle(Throwable thrown);

      , making an instance of it in SimplePluginManager, and setting a default implementation which logs to the console, same as before. You would need to add a method

      setThrowableHandler(ThrowableHandler handler) {

      so that developers could set their own implementation. The instance of this would be used when catching exceptions from onEnable, onDisable, and from events.

            Unassigned Unassigned
            yafta98 Matt Drummond-Stoyles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: