Made the debug text for Error include any sub-errors (#232)

This commit is contained in:
CoffmanLevi 2020-12-29 23:27:32 -08:00 committed by GitHub
parent ffa4a55487
commit b39df21ba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ pub enum Error {
UpdateFailed(String), UpdateFailed(String),
} }
impl fmt::Debug for Error { impl fmt::Display for Error {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
Error::MenusNotSupported => write!(formatter, "Menus not supported"), Error::MenusNotSupported => write!(formatter, "Menus not supported"),
@ -25,13 +25,13 @@ impl fmt::Debug for Error {
} }
} }
impl fmt::Display for Error { impl fmt::Debug for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
Error::MenusNotSupported => write!(fmt, "{:?}", self), Error::MenusNotSupported => write!(fmt, "{}", self),
Error::MenuExists(ref e) => write!(fmt, "{:?} {:?}", self, e), Error::MenuExists(ref e) => write!(fmt, "{}, {:?}", self, e),
Error::WindowCreate(ref e) => write!(fmt, "{:?} {:?}", self, e), Error::WindowCreate(ref e) => write!(fmt, "{}, {:?}", self, e),
Error::UpdateFailed(ref e) => write!(fmt, "{:?} {:?}", self, e), Error::UpdateFailed(ref e) => write!(fmt, "{}, {:?}", self, e),
} }
} }
} }