Assert question?
BlitzMax Forums/BlitzMax Beginners Area/Assert question? Just alternatives.
Ok, thanks!
On a related note is it possible to register an 'error class' so that instead of saying: 'Unhandled Exception' the output window could say for example: 'My Super Module Exception'. That might make it easier to quickly find out where and what went wrong.
Is this done by making an extension to the TBlitzException Type?
(Perhaps it isn't a Beginners Area question anymore)
On a related note is it possible to register an 'error class' so that instead of saying: 'Unhandled Exception' the output window could say for example: 'My Super Module Exception'. That might make it easier to quickly find out where and what went wrong.
Is this done by making an extension to the TBlitzException Type?
(Perhaps it isn't a Beginners Area question anymore)
Hi,
No quite sure what you mean, but...
'Unhandled Exception' means that there was no active 'Try/Catch' block to catch the exception, which is when the debugger kicks in, or the app quits if there's no debugger.
You can bypass this by installing a 'root' Try/Catch handler, eg:
'----main.bmx----
Try
RunMyApp()
Catch ex:Object
Print ex.ToString()
End Try
This will catch *all* exceptions, and the debugger will never be invoked.
You can create your own exception types:
Type MyEx
Method ToString$()
blah
End Method
End Type
Try
RunMyApp()
Catch ex:MyEx
'MyApp caused a MyEx exception
Print "MyEx thrown:"+ex.ToString()
Catch ex:Object
'MyApp caused a non-MyEx exception
Print "Unknown thrown:"+ex.ToString()
End Try
...To throw a MyEx, use 'Throw New MyEx'
No quite sure what you mean, but...
'Unhandled Exception' means that there was no active 'Try/Catch' block to catch the exception, which is when the debugger kicks in, or the app quits if there's no debugger.
You can bypass this by installing a 'root' Try/Catch handler, eg:
'----main.bmx----
Try
RunMyApp()
Catch ex:Object
Print ex.ToString()
End Try
This will catch *all* exceptions, and the debugger will never be invoked.
You can create your own exception types:
Type MyEx
Method ToString$()
blah
End Method
End Type
Try
RunMyApp()
Catch ex:MyEx
'MyApp caused a MyEx exception
Print "MyEx thrown:"+ex.ToString()
Catch ex:Object
'MyApp caused a non-MyEx exception
Print "Unknown thrown:"+ex.ToString()
End Try
...To throw a MyEx, use 'Throw New MyEx'
Ah, ok, I think I understand it now. Thank you!