cairo_vm/vm/errors/
trace_errors.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use thiserror_no_std::Error;

use crate::vm::errors::memory_errors::MemoryError;

#[derive(Debug, PartialEq, Error)]
pub enum TraceError {
    #[error("Trace is not enabled for this run")]
    TraceNotEnabled,
    #[error("Trace is already relocated")]
    AlreadyRelocated,
    #[error("No relocation found for execution segment")]
    NoRelocationFound,
    #[error(transparent)]
    MemoryError(#[from] MemoryError),
    #[error("Trace not relocated")]
    TraceNotRelocated,
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    // Test to catch possible enum size regressions
    fn test_trace_error_size() {
        let size = crate::stdlib::mem::size_of::<TraceError>();
        assert!(size <= 24, "{size}")
    }
}