diff options
Diffstat (limited to 'tools/unitctl/unit-openapi/src/apis/error.rs')
-rw-r--r-- | tools/unitctl/unit-openapi/src/apis/error.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/unitctl/unit-openapi/src/apis/error.rs b/tools/unitctl/unit-openapi/src/apis/error.rs new file mode 100644 index 00000000..a4a1e354 --- /dev/null +++ b/tools/unitctl/unit-openapi/src/apis/error.rs @@ -0,0 +1,18 @@ +use crate::apis::Error; +use std::error::Error as StdError; +use std::fmt::{Display, Formatter}; + +impl Display for Error { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Error::Api(e) => write!(f, "ApiError: {:#?}", e), + Error::Header(e) => write!(f, "HeaderError: {}", e), + Error::Http(e) => write!(f, "HttpError: {:#?}", e), + Error::Hyper(e) => write!(f, "HyperError: {:#?}", e), + Error::Serde(e) => write!(f, "SerdeError: {:#?}", e), + Error::UriError(e) => write!(f, "UriError: {:#?}", e), + } + } +} + +impl StdError for Error {} |