quickjs_rusty/errors/
context_error.rs1use std::{error, fmt};
2
3use super::ExecutionError;
4
5#[derive(Debug)]
7pub enum ContextError {
8 RuntimeCreationFailed,
10 ContextCreationFailed,
12 Execution(ExecutionError),
14 #[doc(hidden)]
15 __NonExhaustive,
16}
17
18impl fmt::Display for ContextError {
19 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20 use ContextError::*;
21 match self {
22 RuntimeCreationFailed => write!(f, "Could not create runtime"),
23 ContextCreationFailed => write!(f, "Could not create context"),
24 Execution(e) => e.fmt(f),
25 __NonExhaustive => unreachable!(),
26 }
27 }
28}
29
30impl error::Error for ContextError {}