BlitzMax Extended  0.8.19
Pushing Blitz to the Max.
Functions
blitz_ex.h File Reference

Exception handling functionality. More...

#include "_common.h"

Go to the source code of this file.

Functions

void bbExThrow (BBObject *obj)
 Throws an object as as an exception.
void bbExThrowCString (const char *c_str)
 Throws an exception message.

Detailed Description

Exception handling functionality.

Throwing an exception instead of returning an error code has the advantage of giving a more detailed description of the error without sacrificing the ability to return any value you want.

Also, it gives you the ability to write libraries (modules) that leave the task of handling the error to the application's programmer. So the application can deal with the problem in an appropriate way, given it has information about the current situation that an external library simply does not have.

In BlitzMax any object can be used thrown and catched to handle exceptional events. The runtime has it's own exceptions that can be found in the 'exceptions' directory. DO NOT EXTEND THOSE (except maybe bbRuntimeExceptionClass).

Author:
Mark Sibly

Function Documentation

void bbExThrow ( BBObject obj)

Throws an object as as an exception.

Parameters:
objAn exception object describing the problem
void bbExThrowCString ( const char *  c_str)

Throws an exception message.

This is propably the fastest way to throw a message out of a C/C++ context. Simply pass the message you want to be thrown as a "const char*" and this will automatically convert it to a BBString. This string can than be catched from within BlitzMax.

Parameters:
c_strA message describing the problem