actions_github/
error.rs

1use std::error::Error;
2use std::fmt::{Display, Formatter};
3
4#[derive(Debug)]
5#[non_exhaustive]
6/// Error occurred duration the execution of the action
7pub enum ActionsError {
8    /// This error happened while generating the context object
9    Context(String),
10    /// The input was not found
11    InputNotFound(String),
12    /// There was a problem while writing the output
13    Output(String),
14}
15
16impl Error for ActionsError {}
17
18impl Display for ActionsError {
19    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
20        use ActionsError::*;
21
22        match self {
23            Context(msg) => write!(f, "Problem while generating the context: {}", msg),
24            InputNotFound(input) => write!(f, "Input required and not supplied: {}", input),
25            Output(msg) => write!(f, "{}", msg),
26        }
27    }
28}