How to make a plugin crash handler?

Discussion in 'Plugin Development' started by Paradox, Apr 15, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Paradox

    I've tried searching on the forum but I keep getting a bad gateway.

    Anyway, has anyone figured out how to make a crash handler for their plugin? (e.g. When the plugin crashes it performs some action). I've been looking into it and I tried doing something like http://stackoverflow.com/questions/...at-perform-certain-action-before-the-system-i, but that didn't even work for me. I suppose I could have implemented it wrong but I'm pretty sure I did it correctly.

    If anyone has any ideas / experience with crash handling I would greatly appreciate some feedback on how I can implement it.
     
  2. Offline

    patman64

    I'm not sure what you mean by "crashes". You mean fails to load? Maybe you could make another plugin that loads afterward and checks whether the plugin loaded?

    Or do you mean when some method throws an exception? You can catch those in your code. For example, you can catch when a method is called on a null object by wrapping it with try and catching NullPointerException.

    And yes, the 502 errors are VERY annoying. Had to post this 6 times to get it through.
     
  3. Offline

    VeryBIgCorp

    You can use try and catch clauses to handle exceptions and then do something in the catch clause if you would like to (such as logging).
     
Thread Status:
Not open for further replies.

Share This Page