It has been discussed above, that some of the PyCLIPS functions can raise a CLIPS specific exception, namely ClipsError. Some of the exceptions of this type (in fact, the ones raised by the underlying CLIPS engine and caught at the lower level), come with an error code in the accompanying text. A brief description of exceptions that arise at low level follows:
| Code | Description |
|---|---|
P01 |
An object could not be created, due to memory issues |
C01 |
The engine could not create a system object |
C02 |
The referred object could not be found in subsystem |
C03 |
An attempt was made to modify an unmodifiable object |
C04 |
A file could not be opened |
C05 |
The current environment could not be retrieved |
C06 |
The engine was unable to return the required value |
C07 |
Parse error in the passed in CLIPS file |
C08 |
Syntax or parse error in the passed in CLIPS expression |
C09 |
Syntax or parse error in the passed in argument |
C10 |
Expression could not be evaluated, maybe because of syntax errors |
C11 |
An object could not be removed from the CLIPS subsystem |
C12 |
A fact could not be asserted, maybe because of
missing deftemplate |
C13 |
Iteration beyond last element in a list |
C14 |
A CLIPS function has been called unsuccessfully |
C15 |
Attempt to modify an already asserted fact was made |
C16 |
Cannot destroy environment while it is current |
C90 |
Other errors: specific description given |
C97 |
The feature is present when a higher version of CLIPS is used |
C98 |
An attempt was made to use an unimplemented feature (see below) |
C99 |
Generic CLIPS error, last operation could not be performed |
C00 |
Generic CLIPS error, no specific cause could be reported |
S01 |
Attempt to access a fact that is no longer valid or has been deleted |
S02 |
Attempt to access an instance that is no longer valid or has been deleted |
S03 |
Clear operation on an environment has failed |
S04 |
Attempt to access an environment that has been deleted |
S05 |
Attempt to operate on alias of current environment |
S06 |
Attempt to create more environments than allowed |
S00 |
Generic internal system error |
R01 |
The logical buffer (I/O Stream) has been misused |
R02 |
The logical buffer with given name could not be found |
R03 |
Could not write to a read-only logical buffer |
These codes can be extracted from the exception description and used to
determine errors - for instance, in an if ... elif ... control
statement. Some of these errors are caught by the PyCLIPS high-level
layer and interpreted in different ways (e.g. the C13 error is
used to generate lists or to return None after last element
in a list).
There are also some CLIPS specific exceptions that can be thrown at the
higher level: they are identified by a code beginning with the letter
M. A list of these exceptions follows, along with their
description:
| Code | Description |
|---|---|
M01 |
A constructor could not create an object |
M02 |
An object could not be found in the CLIPS subsystem |
M03 |
An attempt was made to pickle an object |
M99 |
Wrong Python version, module could not initialize |
Finally, there is a particular error that occurs in case of fatal memory allocation failures, which is identified by a particular exception, namely ClipsMemoryError. This excepion is raised with the following code and has the following meaning:
| Code | Description |
|---|---|
X01 |
The CLIPS subsystem could not allocate memory |
In this case the calling program must exit, as the underlying engine has reached an unstable state. An exception different from the standard ClipsError has been provided in order to allow quick and effective countermeasuresC.1.