Error Rt
| Spice |
|---|
| import "std/runtime/error_rt";
|
Error struct
This is the generalized error type in Spice and part of the error handling mechanism.
Fields
| Name |
Type |
Description |
code |
int |
|
message |
string |
|
Constructors
ctor
Construct a generic error with code 0 and a default message
ctor
| Spice |
|---|
| public p Error.ctor(int errorCode, string message)
|
Construct an error with the given code and message
Parameters
| Name |
Type |
Description |
errorCode |
int |
Error code |
message |
string |
Error message |
ctor
| Spice |
|---|
| public p Error.ctor(string message)
|
Construct an error with the given message and code 1
Parameters
| Name |
Type |
Description |
message |
string |
Error message |
Methods
print
Prints the error message to the console.
toPanic
Panic with this error