fix(napi): display should be implemented on error generics (#1497)
This commit is contained in:
parent
4fc7cb12f4
commit
fc101d0d6b
1 changed files with 3 additions and 3 deletions
|
@ -47,9 +47,9 @@ impl<S: AsRef<str>> ToNapiValue for Error<S> {
|
||||||
unsafe impl<S> Send for Error<S> where S: Send + AsRef<str> {}
|
unsafe impl<S> Send for Error<S> where S: Send + AsRef<str> {}
|
||||||
unsafe impl<S> Sync for Error<S> where S: Sync + AsRef<str> {}
|
unsafe impl<S> Sync for Error<S> where S: Sync + AsRef<str> {}
|
||||||
|
|
||||||
impl error::Error for Error {}
|
impl<S: AsRef<str> + std::fmt::Debug> error::Error for Error<S> {}
|
||||||
|
|
||||||
impl From<std::convert::Infallible> for Error {
|
impl<S: AsRef<str>> From<std::convert::Infallible> for Error<S> {
|
||||||
fn from(_: std::convert::Infallible) -> Self {
|
fn from(_: std::convert::Infallible) -> Self {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ impl From<anyhow::Error> for Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl<S: AsRef<str> + std::fmt::Debug> fmt::Display for Error<S> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
if !self.reason.is_empty() {
|
if !self.reason.is_empty() {
|
||||||
write!(f, "{:?}, {}", self.status, self.reason)
|
write!(f, "{:?}, {}", self.status, self.reason)
|
||||||
|
|
Loading…
Reference in a new issue