#include <error.h>
Public Member Functions | |
void | addTrace (const String &module, const String &symbol, uint32 line, uint32 pc) |
void | appendSubError (Error *sub) |
bool | catchable () const |
void | catchable (bool c) |
uint32 | character () const |
void | character (uint32 chr) |
const String & | className () const |
virtual Error * | clone () const |
void | decref () |
Error (const ErrorParam ¶ms) | |
Error () | |
int | errorCode () const |
void | errorCode (int ecode) |
const String & | errorDescription () const |
void | errorDescription (const String &errorDesc) |
const String & | extraDescription () const |
void | extraDescription (const String &extra) |
bool | hasTraceback () const |
virtual String & | heading (String &target) const |
Writes only the heading of the error to the target string. | |
void | incref () |
uint32 | line () const |
void | line (uint32 line) |
const String & | module () const |
void | module (const String &moduleName) |
bool | nextStep (String &module, String &symbol, uint32 &line, uint32 &pc) |
t_origin | origin () const |
void | origin (t_origin o) |
uint32 | pcounter () const |
void | pcounter (uint32 pc) |
const Item & | raised () const |
void | raised (const Item &itm) |
void | rewindStep () |
virtual CoreObject * | scriptize (VMachine *vm) |
Returns an object that can be set in a Falcon item and handled by a script. | |
Error * | subError () const |
const String & | symbol () const |
void | symbol (const String &symbolName) |
uint32 | systemError () const |
void | systemError (uint32 ecode) |
virtual String & | toString (String &target) const |
String | toString () const |
Protected Member Functions | |
Error (const String &className, const ErrorParam ¶ms) | |
Minimal constructor. | |
Error (const Error &e) | |
Copy constructor. | |
Error (const String &className) | |
Empty constructor. | |
virtual | ~Error () |
Private destructor. | |
Protected Attributes | |
bool | m_catchable |
uint32 | m_character |
String | m_className |
String | m_description |
int | m_errorCode |
String | m_extra |
Error * | m_LastNextError |
uint32 | m_line |
String | m_module |
Error * | m_nextError |
t_origin | m_origin |
uint32 | m_pc |
Item | m_raised |
int32 | m_refCount |
ListElement * | m_stepIter |
List | m_steps |
String | m_symbol |
uint32 | m_sysError |
This class implements an error instance. Errors represent problems occoured both during falcon engine operations (i.e. compilation syntax errors, link errors, file I/O errors, dynamic library load errors ands o on) AND during runtime (i.e. VM opcode processing errors, falcon program exceptions, module function errors).
When an error is raised by an engine element whith this capability (i.e. the compiler, the assembler, the runtime etc.), it is directly passed to the error handler, which has the duty to do something with it and eventually destroy it.
When an error is raised by a module function with the VMachine::raiseError() method, the error is stored in the VM; if the error is "catchable" AND it occours inside a try/catch statement, it is turned into a Falcon Error object and passed to the script.
When a script raises an error both explicitly via the "raise" function or by performing a programming error (i.e. array out of bounds), if there is a try/catch block at work the error is turned into a Falcon error and passed to the script.
If there isn't a try/catch block or if the error is raised again by the script, the error instance is passed to the VM error handler.
Scripts may raise any item, which may not necessary be Error instances. The item is then copied in the m_item member and passed to the error handler.
Falcon::Error::Error | ( | const String & | className | ) | [inline, protected] |
Empty constructor.
The error must be filled with proper values.
Falcon::Error::Error | ( | const Error & | e | ) | [protected] |
Copy constructor.
Falcon::Error::Error | ( | const String & | className, | |
const ErrorParam & | params | |||
) | [inline, protected] |
Minimal constructor.
If the description is not filled, the toString() method will use the default description for the given error code.
virtual Falcon::Error::~Error | ( | ) | [protected, virtual] |
Private destructor.
Can be destroyed only via decref.
Falcon::Error::Error | ( | ) | [inline] |
Falcon::Error::Error | ( | const ErrorParam & | params | ) | [inline] |
void Falcon::Error::addTrace | ( | const String & | module, | |
const String & | symbol, | |||
uint32 | line, | |||
uint32 | pc | |||
) |
void Falcon::Error::appendSubError | ( | Error * | sub | ) |
bool Falcon::Error::catchable | ( | ) | const [inline] |
void Falcon::Error::catchable | ( | bool | c | ) | [inline] |
uint32 Falcon::Error::character | ( | ) | const [inline] |
void Falcon::Error::character | ( | uint32 | chr | ) | [inline] |
const String& Falcon::Error::className | ( | ) | const [inline] |
virtual Error* Falcon::Error::clone | ( | ) | const [virtual] |
void Falcon::Error::decref | ( | ) |
int Falcon::Error::errorCode | ( | ) | const [inline] |
void Falcon::Error::errorCode | ( | int | ecode | ) | [inline] |
const String& Falcon::Error::errorDescription | ( | ) | const [inline] |
void Falcon::Error::errorDescription | ( | const String & | errorDesc | ) | [inline] |
const String& Falcon::Error::extraDescription | ( | ) | const [inline] |
void Falcon::Error::extraDescription | ( | const String & | extra | ) | [inline] |
bool Falcon::Error::hasTraceback | ( | ) | const [inline] |
Writes only the heading of the error to the target string.
The error heading is everything of the error without the traceback. This method never recurse on error lists; only the first heading is returned.
The returned string doesn't terminate with a "\n".
void Falcon::Error::incref | ( | ) |
uint32 Falcon::Error::line | ( | ) | const [inline] |
void Falcon::Error::line | ( | uint32 | line | ) | [inline] |
const String& Falcon::Error::module | ( | ) | const [inline] |
void Falcon::Error::module | ( | const String & | moduleName | ) | [inline] |
t_origin Falcon::Error::origin | ( | ) | const [inline] |
void Falcon::Error::origin | ( | t_origin | o | ) | [inline] |
uint32 Falcon::Error::pcounter | ( | ) | const [inline] |
void Falcon::Error::pcounter | ( | uint32 | pc | ) | [inline] |
const Item& Falcon::Error::raised | ( | ) | const [inline] |
void Falcon::Error::raised | ( | const Item & | itm | ) | [inline] |
void Falcon::Error::rewindStep | ( | ) |
virtual CoreObject* Falcon::Error::scriptize | ( | VMachine * | vm | ) | [virtual] |
Returns an object that can be set in a Falcon item and handled by a script.
This method converts the error object in a Falcon Object, derived from the proper class.
The method must be fed with a virtual machine. The target virtual machine should have linked a module providing a "specular class". This method will search the given VM for a class having the same name as the one that is returned by the className() method (set in the constructor by the subclasses of Error), and it will create an instance of that class. The method will then fill the resulting object with the needed values, and finally it will set itself as the User Data of the given object.
The target class Falcon should be a class derived from the Core class "Error", so that the inherited methods as "toString" and "traceback" are inherited too, and so that a check on "Error" inheritance will be positive.
Error* Falcon::Error::subError | ( | ) | const [inline] |
const String& Falcon::Error::symbol | ( | ) | const [inline] |
void Falcon::Error::symbol | ( | const String & | symbolName | ) | [inline] |
uint32 Falcon::Error::systemError | ( | ) | const [inline] |
void Falcon::Error::systemError | ( | uint32 | ecode | ) | [inline] |
String Falcon::Error::toString | ( | ) | const [inline] |
bool Falcon::Error::m_catchable [protected] |
uint32 Falcon::Error::m_character [protected] |
String Falcon::Error::m_className [protected] |
String Falcon::Error::m_description [protected] |
int Falcon::Error::m_errorCode [protected] |
String Falcon::Error::m_extra [protected] |
Error* Falcon::Error::m_LastNextError [protected] |
uint32 Falcon::Error::m_line [protected] |
String Falcon::Error::m_module [protected] |
Error* Falcon::Error::m_nextError [protected] |
t_origin Falcon::Error::m_origin [protected] |
uint32 Falcon::Error::m_pc [protected] |
Item Falcon::Error::m_raised [protected] |
int32 Falcon::Error::m_refCount [protected] |
ListElement* Falcon::Error::m_stepIter [protected] |
List Falcon::Error::m_steps [protected] |
String Falcon::Error::m_symbol [protected] |
uint32 Falcon::Error::m_sysError [protected] |