How to exit graphics on error?

BlitzMax Forums/BlitzMax Beginners Area/How to exit graphics on error?

Canali(Posted 2009) [#1]
Hi.
I am debugging a program that enters the graphics mode but, when the exectuin meets an error, I just hear the "error sound" but the graphic window doesn't automatically exits from the graphics mode.

Is there a way to enable it or a walkaround?


Canali(Posted 2009) [#2]
Ooops,
I posted in the wrong forum.

Could a mod move my topic in the right section?
Thanks.


GfK(Posted 2009) [#3]
Better to run in windowed mode for testing.

(this should be in one of the programming forums, not Tutorials)


neos300(Posted 2009) [#4]
EndGraphics, maybe?


Evil Roy Ferguson(Posted 2009) [#5]
Use a Try/Catch. RuntimeErrors throw an exception.

Try
	Main()
Catch a:Object
	EndGraphics
	Throw a
End Try

Function Main()
	Graphics 640, 480, 16
	RuntimeError "A bad thing happened"
End Function