How to check for console errors?

Discussion in 'Spigot Plugin Development' started by Inkzzz, May 28, 2015.

  1. Inkzzz

    Resource Staff

    Hey,
    I'm wondering how I'd check for console errors, so that I can store them In a .YML file, therefore I'll be aware of them rather than going through an entire log all the time.

    Thanks!
     
  2. Try and catch.
     
  3. Inkzzz

    Resource Staff

    Yes, but, how?
     
  4. When an exception is thrown, write the stack-trace to the file using a try and catch block.
     
  5. Inkzzz

    Resource Staff

    My question is how do I make it to know when an Exception has been thrown?
     
  6. Not sure what you mean,
    But here's what @Skionz means

    try{
    //execute the code
    }catch(<exception type>){
    //catch an exception and write stack-trace to file.
    }
     
  7. Inkzzz

    Resource Staff

  8. You may be able to use a PrintStream, calling System.setOut(yourPrintStream) and have it write to the file. I am not completely sure if that would work or if I am making any sense right now.
     
    • Like Like x 1
  9. Or...

    Code (Text):
    try {
    // Code
    } catch (Exception e) {
    this.getConfig().set(String, e.getPrintStackTrace());
    // I think.  I'm not using eclipse for this :P
    }
     
  10. Syntax error :p
     
    • Winner Winner x 1
  11. Is getPrintStackTrace even a real method?
     
  12. Yea I know XD
     
  13. I think so.
     
  14. Actually you are making sense @BetaNyan but I don't think it would work.try and cahtch will do the trick.
     
  15. I tried it and it didn't come up :( I'll look more into it.
     
  16. Luck is very important :D