8) APyaX Error Handling

APyaX errors result in error strings being generated. The format of the string consists of a number of fields separated by | characters and is discussed below.

8.1) Passing Errors back to the web page

For form upload (section 7) and asynchronous APyaX calls, this error string is passed back to the page via a JavaScript error handler function, if defined.

For synchronous APyaX calls, the error string is thrown as a JavaScript exception.

For file download (section 6), APyaX does not provide error handling, other than failing the request for the file.

8.2) APyaX Error String Format

APyaX Error String Format (field delimiter is the | character)

Field

Purpose

error number

a numeric code describing the type of error

error source

identifies the source of the error:

system - an error raised by APyaX
user - an error raised within a user function
python - an exception raised by python
database - an exception raised during database access

client - an error raised by the client part of APyaX (apyax.js)

error text brief

A short description of the error

error text detailed

A longer, more detailed description (for example, a stack trace).

The following error numbers are defined for system errors



Error Numbers returned for APyaX System Errors

System Error Number

Purpose

1

Could not parse the APyaX configuration file $APYAXCFG. Check the file for errors.

2

Could not open the APyaX configuration file $APYAXCFG. Check that the file exists and permissions are OK.

3

Could not load an existing session from persistent storage.

4

Could not save a session to persistent storage. Check available file system space.

5

Security violation - an attempt was made to call a python function which exists but is not exposed by APyaX (its first parameter is not named "apyax")

6

Error encountered executing a user script.