htsget_http/middleware/
error.rs

1//! Errors related to middleware.
2//!
3
4use crate::HtsGetError;
5use std::result;
6use thiserror::Error;
7
8/// The result type for middleware errors.
9pub type Result<T> = result::Result<T, Error>;
10
11/// The error type for middleware errors.
12#[derive(Error, Debug)]
13pub enum Error {
14  #[error("building auth middleware: {0}")]
15  AuthBuilderError(String),
16}
17
18impl From<jsonwebtoken::errors::Error> for HtsGetError {
19  fn from(err: jsonwebtoken::errors::Error) -> Self {
20    Self::InvalidAuthentication(format!("invalid JWT: {err}"))
21  }
22}