I am using LWJGL to make my new game.
Quick Question:
When my game crashes with something like this:
Exception in thread "main" java.lang.NullPointerException at engineTester.MainGameLoop.main(MainGameLoop.java:376) C:\Users\users\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
How do I get it to print it in dialog so that when someone runs it and it crashes they will be able to see it as a dialog that is has crashed
Hope it made sense
You can use try
...catch
and catch the exception (in a baseclass / superclass), send the user an error code that he can report and log a more detailed error. Depending on your configuration:
...
try {
/* game is playing() */
}
catch (MyGameException gameException) {
logging.log(gameException.log());
sendErrorCodeToTheUser(gameException);
}
I had a similar discussion with a colleague that a user can report an error code 1-10 or 1-1000 while the programmers can have a detailed log where the nullpointer was.