Xen / reference v0.1.0-demo.2
Errors and termination
This topic is not available in the selected language or version. Showing the start of this section.
Failure as a value
Section titled “Failure as a value”A possibly absent value is Option.Some(value) or Option.None. A fallible operation returns Result.Ok(value) or Result.Err(error). Handle each case with match. ? extracts success or propagates an error to the caller; the function needs a compatible Result return type.
Termination
Section titled “Termination”panic(message) terminates the program. Panic and runtime errors skip normal block cleanup. Handle expected file and input errors using Result. Exceptions are unavailable.
| CLI exit status | Meaning |
|---|---|
| 0 | Success |
| 1 | Code, runtime, or test error, or no matching tests |
| 2 | Invalid command usage |
run propagates the program’s exit status.
Learn more: Missing values and errors · Command-line tools