error.eh
Error handling. More...
Constants
Functions
Description
Errors are thrown in exceptional situations, when program cannot proceed normally.
Error
object contains full trace of function calls to find out where error
happened. For example this program:
produces the following output
Division by zero
@div(example.e:4)
@main(example.e:7)
|
Here you can find, what function sequence in what source caused the error (to make
sources appear in trace of function calls you need to compile with
-g
option).
If you want to not pass error but handle it in your code, use try/catch
block.
In the last example, an
err
variable contains
Error
value. You can work
with this value using functions from this header. Finally, you may throw your own
errors using
error function. Error code defines type of the error. Error codes
100..199 are reserved for system error types.
Constant details
Indicates that no error occured.
This convenient constant may be returned by main() if application
ends normally. You cannot create an Error with zero error code.
Indicates that program ends with error.
This convenient constant may be returned by main() if application
ends abnormally.
Indicates that serious error occured in Alchemy OS.
System error means that process cannot proceed normally due to
system failure. For example, there is not enough memory.
Indicates that operation failed because its argument is
null
.
Null value usually means that you forgot to assign value to a variable or structure
field. Also, elements of new arrays are unset, so they return null. Some functions
may return null intentionally.
Indicates that operation failed because of input/output error.
Errors of this kind may be thrown by all functions that work with files and
network.
Indicates that an application tries to request or assign value that is out of given range.
For example, this error is thrown when program tries to access array element
at index less than zero or greater than array length.
Indicates that an application tries to create an array with negative size.
Indicates that function has received illegal or inappropriate argument.
const ERR_ILL_STATE = 106 |
Indicates that function has been called at an illegal or inappropriate time.
In other words, application is not in appropriate state for the requested operation.
Indicates security violation.
const ERR_TYPE_MISMATCH = 108 |
Indicates that application has tried to operate on a value of the wrong type.
const ERR_DIV_BY_ZERO = 109 |
Indicates that application has tried to divide by zero.
This error is thrown only by integer arithmetics. Floating point
division successfully returns
NaN.
const ERR_INTERRUPT = 110 |
Indicates that process was interrupted.
Indicates that media playback failed.
Function details
Returns error code of this error.
Returns detail message of this error.
Converts this error to a string containing error message and trace of function calls.
Raises error with given error code and detail message.