Error Rt¶
| 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 message
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
print¶
| Spice | |
|---|---|
Prints the error message to the console.
triggerPanic¶
| Spice | |
|---|---|
Panic with this error
dumpTrace¶
| Spice | |
|---|---|
Prints the error message and the recorded error return trace to stderr. A no-op if no trace was ever recorded, which is always the case unless #![core.compiler.errorReturnTracing = true] was set somewhere along the propagation chain - so this is always safe to call regardless of that attribute's state.
ErrorCode enum¶
| Item | Value | Description |
|---|---|---|
Ok |
0 |
|
RuntimeError |
1 |