golem_rib_repl/
repl_bootstrap_error.rs1use std::fmt::{Display, Formatter};
2
3#[derive(Debug, Clone, PartialEq)]
5pub enum ReplBootstrapError {
6 MultipleComponentsFound(String),
14
15 NoComponentsFound,
17
18 ComponentLoadError(String),
20
21 ReplHistoryFileError(String),
23}
24
25impl std::error::Error for ReplBootstrapError {}
26
27impl Display for ReplBootstrapError {
28 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
29 match self {
30 ReplBootstrapError::MultipleComponentsFound(msg) => {
31 write!(f, "Multiple components found: {msg}")
32 }
33 ReplBootstrapError::NoComponentsFound => {
34 write!(f, "No components found in the given context")
35 }
36 ReplBootstrapError::ComponentLoadError(msg) => {
37 write!(f, "Failed to load component: {msg}")
38 }
39 ReplBootstrapError::ReplHistoryFileError(msg) => {
40 write!(f, "Failed to read/write REPL history file: {msg}")
41 }
42 }
43 }
44}