questrade_rs/
error.rs

1use http::StatusCode;
2use thiserror::Error;
3
4/// API error types.
5#[derive(Error, Debug)]
6pub enum ApiError {
7    /// Raised when a response is missing a field
8    #[error("Missing field in json response: {0}")]
9    MissingFieldError(&'static str),
10
11    /// Raised when a field cannot be converted to the specified type
12    #[error("Cannot convert field {0} to type {1}")]
13    InvalidTypeError(&'static str, &'static str),
14
15    /// Raised when a API call is made and the user isn't authenticated
16    #[error("Not authenticated")]
17    NotAuthenticatedError(StatusCode),
18}