inkpad_cli/
result.rs

1//! Inkpad CLI Error
2use inkpad_executor::Error as Executor;
3use inkpad_runtime::Error as Runtime;
4use inkpad_support::errors;
5use etc::Error as Etc;
6use parity_scale_codec::Error as Codec;
7use sled::Error as Sled;
8use std::{
9    error::Error as ErrorTrait,
10    fmt::{Display, Formatter, Result as FmtResult},
11    io::Error as Io,
12};
13
14#[derive(Debug)]
15pub struct CouldNotParseCommand(String);
16#[derive(Debug)]
17pub struct ParseContractFailed(String);
18#[derive(Debug)]
19pub struct DecodeAddressFailed(String);
20#[derive(Debug)]
21pub struct Custom(String);
22
23errors! {
24    Codec,
25    Runtime,
26    Executor,
27    Etc,
28    Sled,
29    Io,
30    CouldNotParseCommand,
31    DecodeAddressFailed,
32    ParseContractFailed,
33    Custom
34}
35
36impl From<&'static str> for Error {
37    fn from(s: &'static str) -> Error {
38        Error::Custom(s.into())
39    }
40}
41
42/// Inkpad result
43pub type Result<T> = core::result::Result<T, Error>;