Handling Errors

BlitzMax Forums/BlitzMax Programming/Handling Errors

William Drescher(Posted 2008) [#1]
Is there a way to put an error handling system into your program? I'd like to be able to handle errors that are thrown by the debugger/Windows in my own code.


GfK(Posted 2008) [#2]
You can use Assert.


Brucey(Posted 2008) [#3]
You can use Assert.

Only in Debug mode - so fine for testing but not as useful for catching issues in Release mode.

You might look at Try/Catch with Exceptions. There is some documentation about it in the Help section.


William Drescher(Posted 2008) [#4]
That's good, but I mean like when the debugger throws a "UME" error, I want to be able to print it out in my graphics window, rather than the message box appearing. Is that possible?


jamesmintram(Posted 2008) [#5]
UME?


VIP3R(Posted 2008) [#6]
Unhandled Memory Exception


christian223(Posted 2008) [#7]
Im not sure, but maybe you can use this functions?:

Function Notify( text$,serious=False )

Function Confirm( text$,serious=False )

Function Proceed( text$,serious=False )


They are in the manual.


Zeke(Posted 2008) [#8]
Strict
Graphics 800 , 600

While Not KeyHit(key_escape) 
	For Local i = 10 To 0 Step - 1
		Cls
		Local a:Float
	
		Try
			a = 10/i
		Catch a:Object
			Cls
			DrawText "ERROR: " + a.tostring() , 0 , 0
			DrawText "hit any key to exit...",0,20
			Flip
			WaitKey() 
			End
		EndTry
		
		DrawText "10/"+i+"= " + a , 0 , 0
		Flip
		Delay 200
	Next
Wend