Try/Catch
BlitzMax Forums/BlitzMax Programming/Try/Catch
| ||
What is the point of using Try/Catch in the file loaders? All this seems to do is mask the source of any error that occurs. |
| ||
You use them to stop your program bombing out. For example your program reads/writes to files and you want to guarantee that it's safe to do so then use Try / Catch. This way if it's not safe to do it your program won't freak and instead you can display a nice "can not do this" info box. |
| ||
Very usefull when reading from internet or removable devices. |
| ||
I would think the point is to just catch the exception so you can do something more constructive with it. |
| ||
I have a question about try/catch. When I use it in debug mode it seems to work just fine, it catches the exception (trying to load an invaild image) and goes on with life. However, if I build only the GUI App (disable quick build and debug build) it seems to ignore the try/catch block. Is this intended? What can I do in its place? |
| ||
It does not needfully ignore it. Perhaps just the exception is not thrown anymore (file io for example when I remember correctly). As well the thrown exceptions won't cause runtime errors anymore if not catched. |
| ||
Some exceptions only get thrown in debug mode. |
| ||
Some exceptions only get thrown in debug mode. Namely those thrown by Assert. |