chore: moving to color_eyre

This commit is contained in:
Justin Miller
2021-10-10 19:26:34 -06:00
committed by Aiden McClelland
parent 36bae894a9
commit 81164f974f
38 changed files with 380 additions and 180 deletions

View File

@@ -1,5 +1,5 @@
use anyhow::anyhow;
use basic_cookies::Cookie;
use color_eyre::eyre::eyre;
use digest::Digest;
use futures::future::BoxFuture;
use futures::{FutureExt, TryFutureExt};
@@ -29,7 +29,7 @@ pub fn get_id(req: &RequestParts) -> Result<String, Error> {
}
}
Err(Error::new(
anyhow!("UNAUTHORIZED"),
eyre!("UNAUTHORIZED"),
crate::ErrorKind::Authorization,
))
}
@@ -50,7 +50,7 @@ pub async fn is_authed(ctx: &RpcContext, id: &str) -> Result<(), Error> {
.await?;
if session.rows_affected() == 0 {
return Err(Error::new(
anyhow!("UNAUTHORIZED"),
eyre!("UNAUTHORIZED"),
crate::ErrorKind::Authorization,
));
}

View File

@@ -19,7 +19,7 @@ pub async fn diagnostic<M: Metadata>(
if let Err(e) = rpc_res {
if e.code == -32601 {
*e = Error::new(
anyhow::anyhow!(
color_eyre::eyre::eyre!(
"{} is not available on the Diagnostic API",
method
),

View File

@@ -3,7 +3,7 @@ use std::sync::Arc;
use aes::cipher::{CipherKey, NewCipher, Nonce, StreamCipher};
use aes::Aes256Ctr;
use anyhow::anyhow;
use color_eyre::eyre::eyre;
use futures::future::BoxFuture;
use futures::{FutureExt, Stream};
use hmac::Hmac;
@@ -193,7 +193,7 @@ pub fn encrypt<
&req.headers,
res_parts,
Err(Error::new(
anyhow!("Must be encrypted"),
eyre!("Must be encrypted"),
crate::ErrorKind::Authorization,
)
.into()),