vjurenka / BWMirror

BWMirror API source files
Other
55 stars 13 forks source link

Exceptions not being caught #15

Closed uozuAho closed 9 years ago

uozuAho commented 9 years ago

Hi there, this could just be something I'm doing wrong, but when an exception occurs in my onFrame method, the bot continues to run, just any code in the method after the exception is not run.

For example if I use your example bot, and put the following at the top of onFrame:

Unit unit = null;
System.out.println(unit.getType().toString();

No errors are printed out, but all units just sit there.

Is there some way to catch these exceptions? It'd be really nice, since I'm using println's to figure out where things are going wrong at the moment :(

I'm using

Plankton555 commented 9 years ago

Hi. I believe that is intended behaviour (I have noticed the same thing). My recommendation would be that you use your own try-catch statements. That way, you have more control of the exception handling.

uozuAho commented 9 years ago

Haha, oops - that works, thank you! For some reason try-catch slipped my mind - I was just hoping my program would crash and give me a stack trace.

I guess this isn't a problem with BWMirror then. Should I close this issue?