Suggested error handling tweak

Hard crashes on errors aren’t very pretty so I suggest we add this: (error message can be anything you want). It’s a small change so I just posted the code up here.



Add the following to the AbstractGame class


   private static final String LIBRARY_ERROR=   "Error 101: Unable to find lwjgl library file in your java path.n" +
               "Probably need to add -Djava.library.path=./library to javan" +
               "command where ./library is the path to the lwjgl libraries.n";




Inside the function AbstractGame.getAttributes() change

         LWJGLPropertiesDialog dialog = new LWJGLPropertiesDialog(properties, dialogImage);



to

         LWJGLPropertiesDialog dialog = null;
         try{
               dialog = new LWJGLPropertiesDialog(properties, dialogImage);
         } catch (UnsatisfiedLinkError e){
            JOptionPane.showMessageDialog(null,LIBRARY_ERROR,"Error 101",JOptionPane.ERROR_MESSAGE);
            System.exit(0);
         }

Certainly looks reasonable to me.

Should the string really be placed in the AbstractGame class though? Since this is an LWJGL related string, maybe it should be placed in… uh… a LWJGL related class? :wink:



Do I make any sense?

Or make the string not reference LWJGL:


"Error 101: Unable to find required libraries in your java path.n" +
"Probably need to add -Djava.library.path=./library to javan" +
"command where ./library is the path to the libraries.n";

WHy does abstract game use something called LWJGLPropertiesDialog instead of PropertiesDialog?

It shouldn’t, but awhile back we were experimenting with filling the values of the combo boxes more accurately, involving directly using LWJGL. One of the many things that needs cleaning up.