Exception Handling

BlitzMax Forums/BlitzMax Programming/Exception Handling

I got a very explanatory code example from a very very very advanced user of BlitzMax. regarding the exception issues here discussed and that's the always working' exception handling code:

Strict

Try
	'Test code:
	Assert False, "This is an error!"
	'end of test code

Catch ex:Object
	Notify TTypeId.ForObject(ex).Name() + ":" + ex.ToString()
End Try

Catching the exception as an object fires the catch statement for EVERY possible exception, then using a simple reflection operation we can get the exception information.
It seems it is possible to have several catch statements for a single Try block, something like:
Try
...
Catch ex:TStreamReadException
...
Catch ex:TStreamWriteException
...
Catch ....
End Try

It seems very obvious now, doesn't it?