I agree. There are quite a few places where IllegalArgumentExceptions are being thrown and these need to be trapped so they don't blow up at the API layer. This goes for every kind of exception, but I expect that most of the offenders will be IllegalArgumentExceptions.
I'm not sure yet whether this should be handled with "Pokemon handlers" at the top (catch them all with try {} catch (Exception &ex)) or if these should be done more surgically so that the error codes can be assigned more appropriately. I am leaning towards the latter, but that means I won't be getting to it as fast.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Created the amg-exceptions-3 branch to work on this. So far, I think I have cleaned up all of the offending IllegalArgumentExceptions and also took care of a NumberFormatException that wasn't being handled.
I dealt with this by adding explicit IllegalArgumentException references to the various throw() declarations where they were actually could be thrown, and tried to add handlers to all of the callers. I think I got all of them. Since C++ does not really do statically checked exceptions, adding to the throw() lists is probably a useless exercise, but I consider it to be a form of documentation for the moment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I agree. There are quite a few places where IllegalArgumentExceptions are being thrown and these need to be trapped so they don't blow up at the API layer. This goes for every kind of exception, but I expect that most of the offenders will be IllegalArgumentExceptions.
I'm not sure yet whether this should be handled with "Pokemon handlers" at the top (catch them all with try {} catch (Exception &ex)) or if these should be done more surgically so that the error codes can be assigned more appropriately. I am leaning towards the latter, but that means I won't be getting to it as fast.
Created the amg-exceptions-3 branch to work on this. So far, I think I have cleaned up all of the offending IllegalArgumentExceptions and also took care of a NumberFormatException that wasn't being handled.
I dealt with this by adding explicit IllegalArgumentException references to the various throw() declarations where they were actually could be thrown, and tried to add handlers to all of the callers. I think I got all of them. Since C++ does not really do statically checked exceptions, adding to the throw() lists is probably a useless exercise, but I consider it to be a form of documentation for the moment.
The branch was merged (234:236) back to trunk at revision 242 and resolved at 243. Closing this issue.