1use thiserror::Error;
10
11#[derive(Debug, Error)]
13pub enum RuntimeError {
14 #[error("compilation error: {0}")]
16 Compile(String),
17
18 #[error("backend error: {0}")]
20 Backend(String),
21
22 #[error("device error: {0}")]
24 Device(String),
25
26 #[error("memory error: {0}")]
28 Memory(String),
29
30 #[error("launch error: {0}")]
32 Launch(String),
33
34 #[error("emulator error: {0}")]
36 Emulator(String),
37
38 #[error("I/O error: {0}")]
40 Io(String),
41
42 #[error("invalid argument: {0}")]
44 InvalidArgument(String),
45}
46
47impl From<wave_compiler::CompileError> for RuntimeError {
48 fn from(e: wave_compiler::CompileError) -> Self {
49 Self::Compile(e.to_string())
50 }
51}
52
53impl From<wave_emu::EmulatorError> for RuntimeError {
54 fn from(e: wave_emu::EmulatorError) -> Self {
55 Self::Emulator(e.to_string())
56 }
57}
58
59impl From<std::io::Error> for RuntimeError {
60 fn from(e: std::io::Error) -> Self {
61 Self::Io(e.to_string())
62 }
63}