Mercurial > core / rust/lib/obj/src/err.rs
changeset 17: |
c7165d93a9eb |
author: |
ellis <ellis@rwest.io> |
date: |
Sun, 22 Oct 2023 23:03:15 -0400 |
permissions: |
-rw-r--r-- |
description: |
add obj and net src |
5 pub type Result<T> = std::result::Result<T, Error>; 11 Ron(ron::error::Error), 12 Json(serde_json::error::Error), 14 Bincode(bincode::Error), 15 Utf8(std::string::FromUtf8Error), 16 #[cfg(feature = "hg")] 17 Hg(hg_parser::ErrorKind), 18 Parse(std::string::ParseError), 19 // TODO [2021-08-25 Wed 21:58] : Git() 22 impl serde::ser::Error for Error { 23 fn custom<T: fmt::Display>(msg: T) -> Self { 24 Error::Message(msg.to_string()) 28 impl serde::de::Error for Error { 29 fn custom<T: fmt::Display>(msg: T) -> Self { 30 Error::Message(msg.to_string()) 34 impl fmt::Display for Error { 35 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 37 Error::Message(msg) => f.write_str(msg), 38 Error::Io(ref err) => write!(f, "obj IO error: {}", err), 39 Error::Ron(ref err) => write!(f, "obj Ron error: {}", err), 40 Error::Json(ref err) => write!(f, "obj Json error: {}", err), 41 Error::Bincode(ref err) => write!(f, "obj Bincode error: {}", err), 42 Error::Utf8(ref err) => write!(f, "obj Utf8 error: {}", err), 43 #[cfg(feature = "hg")] 44 Error::Hg(ref err) => write!(f, "obj MercurialRepo error: {}", err), 45 Error::Parse(ref err) => write!(f, "obj Parse error: {}", err), 50 impl From<io::Error> for Error { 51 fn from(e: io::Error) -> Self { 56 impl From<std::string::ParseError> for Error { 57 fn from(e: std::string::ParseError) -> Self { 62 impl From<std::string::FromUtf8Error> for Error { 63 fn from(err: std::string::FromUtf8Error) -> Self { 68 impl From<ron::Error> for Error { 69 fn from(e: ron::Error) -> Self { 74 impl From<serde_json::Error> for Error { 75 fn from(e: serde_json::Error) -> Self { 80 impl From<bincode::Error> for Error { 81 fn from(e: bincode::Error) -> Self { 86 #[cfg(feature = "hg")] 87 impl From<hg_parser::ErrorKind> for Error { 88 fn from(e: hg_parser::ErrorKind) -> Self { 93 impl std::error::Error for Error {}