Error Rt Freestanding¶
| Spice | |
|---|---|
Error struct¶
This is the generalized error type in Spice and part of the error handling mechanism.
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct a generic error with code 0 and a default message
ctor¶
| Spice | |
|---|---|
Construct an error with the given code and message
Parameters
| Name | Type | Description |
|---|---|---|
errorCode |
ErrorCode |
Error code |
message |
string |
Error message |
ctor¶
| Spice | |
|---|---|
Construct an error with the given message and code 1
Parameters
| Name | Type | Description |
|---|---|---|
message |
string |
Error message |
Methods¶
getCode¶
| Spice | |
|---|---|
Retrieve error code
Returns: ErrorCode — Error code
getMessage¶
| Spice | |
|---|---|
Retrieve error message as immutable string
Returns: string — Error message
isOk¶
| Spice | |
|---|---|
Check if the error is set to the default error code 0, which means ok / no error
Returns: bool — Is set to error code 0
dumpTrace¶
| Spice | |
|---|---|
Prints the error message and the recorded error return trace. There is no stderr in freestanding mode and error return tracing is disabled, so this does nothing. It exists, so that code calling it compiles in both modes.
triggerPanic¶
| Spice | |
|---|---|
Panic with this error
ErrorCode enum¶
| Item | Value | Description |
|---|---|---|
Ok |
0 |
|
RuntimeError |
1 |