Catching Console Errors

Discussion in 'Plugin Development' started by ColonelHedgehog, Oct 16, 2014.

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

    ColonelHedgehog

    Haven't posted here in forever. o_o

    Is it possible to listen for ALL errors? I tried several stock Java methods to listen for errors thrown in the console, but it appears that Bukkit has its own system for handling errors that isn't passed through it.
     
  2. Offline

    Dubehh

    I think all errors appear as Exceptions (NullPointer, ClassNotFound, NumberFormat)

    So I think global 'Exception' is catching all errors. Not sure though
    Code:java
    1. try{
    2. //something
    3. } catch (Exception e){
    4. // print stack trace
    5. }
     
    FerusGrim likes this.
  3. Offline

    fireblast709

    Gotta catch 'em all~. It is generally bad to catch Exception, as there are exceptions that aren't meant to be caught (like NullPointerExceptions)
     
  4. Offline

    ColonelHedgehog

    Thanks, but this is not what I mean.

    I'd like to listen for ALL errors. Not just ones from my plugin. Think of it like this:

    Code:java
    1.  
    2. @EventHandler
    3. public void onConsolePrint(ConsolePrintEvent event)
    4. {
    5. if(event.getType() == ConsoleType.ERROR)
    6. {
    7. // blah blah blah
    8. }
    9. }
     
Thread Status:
Not open for further replies.

Share This Page