NAME ^

classes/exception.pmc - Exception PMC

DESCRIPTION ^

This is the exception base class.

As we are still lacking objects, this class is based on a SArray. This will probably change.

An exception object has these attributes:

0 _message

Textual representation of the exception.

1 _type

The exception type, (see src/exceptions.h, except_type.pasm).

2 _severity

The severity of the exception, (see src/exceptions.h, except_severity.pasm).

3 _P5

The contents of REG_PMC(5).

4 _return_cc

The return continuation.

Optional:

5 _C_file

The C code file in which the exception was raised.

6 _C_line

The line of C code on which the exception was raised.

7 _P_file

The PASM/PIR/Perl file in which the exception was raised.

8 _P_line

The line of PASM/PIR/Perl code on which the exception was raised.

...

Any information attached by the HL. This shouldn't start with an underscore (that is reserved for Parrot's internal usage. These are stored as properties.

When an exception handler is called, the exception object is passed as REG_PMC(5), the original contents of this register is in the exception object's _P5 attribute.

This is experimental code. The enum_class of the Exception isn't fixed. The interface isn't fixed.

Methods ^

void init()

Initializes the exception with default values.

STRING *get_string_keyed(PMC *key)

Returns the Parrot string value for *key. The only current recogniced key is "_message".

STRING *get_string()

Return the excpetion message.

INTVAL get_integer_keyed(PMC *key)

Returns the integer value for *key.

PMC *get_pmc_keyed(PMC *key)

Returns the PMC value for *key.

void set_string_keyed(PMC *key, STRING *value)

Sets the Parrot string value for *key.

void set_integer_keyed(PMC *key, INTVAL value)

Sets the integer value for *key.

void set_pmc_keyed(PMC *key, PMC *value)

Sets the PMC value for *key.

INTVAL is_equal(PMC *value)

Compare the passed in Exception with SELF. Returns True if SELF isa value

HISTORY ^

Initial revision by leo 2003.07.10.


parrot