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
30
31
32
33
34
35
36
37
38
//! Model checking error.
use std::fmt::Debug;
use crate::logger::LogEntry;
/// Stores information about an error found by model checking.
#[derive(PartialEq, Debug)]
pub struct McError {
message: String,
trace: Vec<LogEntry>,
}
impl McError {
/// Creates new model checking error.
pub fn new(message: String, trace: Vec<LogEntry>) -> Self {
Self { message, trace }
}
}
impl McError {
/// Returns the error message.
pub fn message(&self) -> String {
self.message.clone()
}
/// Returns the execution trace which led the system to erroneous state.
pub fn trace(&self) -> &Vec<LogEntry> {
&self.trace
}
/// Prints error trace.
pub fn print_trace(&self) {
for entry in &self.trace {
entry.print();
}
}
}