Returns an error.
This function does not generate a change.
err([code, [message]])
Argument | Type | Description |
---|---|---|
code | int (optional) | Integer error code between -127 and -50, defaults to -100. See error documentation for build-in errors. |
message | str (optional) | Optional error message. |
An error value (in a client response, an error value will be packed as a string value with the error message).
This code shows some return values for err():
// Error 59 is the internal integer overflow error
[
err(),
err(-100, 'some error occurred'),
err(-101),
err(-59),
];
Return value in JSON format
[
"error:-100",
"some error occurred",
"error:-101",
"integer overflow"
]