« MBS Real Studio Plugi… | Home | Omegabundle 2012 - en… »

Better OutOfBoundsException

Maybe you saw my feedback case 12703 about adding more details to the message of OutOfBoundsException objects automatically. A little change in the code generator could create message texts for those exceptions giving details on what went wrong.

Today I spend a couple of hours going through my own plugins and do this change myself for my functions. The plugin knows the allowed range and also which function you called. So we can give this detail in the message. If you have a bug reporter phoning home, you can analyze the message later. (For example using our Bug Reporter Kit).

So this code:

dim m as new PictureMatrixMBS
m.Matrix(9,9) = 5

Now raises an OutOfBoundsException with message "Parameter x to method Matrix is too big. Range is 0 to 4, but value is 9.".

In addition we improved memoryblock checks for nil. So calling some functions with a nil memoryblock no longer silently fails, but raises an exception. For example NewCFBinaryDataMBSMem now raises a NilObjectException with message "memoryblock is nil" if you call it with nil for the memoryblock parameter. Something you should never do.

Those new checks may raise exceptions where code worked just fine before. But I think it's important to fix problems and not have functions fail silently in case something is really screwed up. Of course there is a possibility that one of the checks is wrong, so please report if you see an exception and you thing it is wrong placed. For example an out of bounds check could off by one. If you see a problem, please do not hesitate to tell us.

By the way, I also made some new feature request in this direction: Feedback #22194: Show Exception message in debugger and Feedback #22194: Show exception in debugger variables The biggest plugin in space...
17 08 12 - 23:14