Skip to main content

fortnite/
errors.rs

1#![allow(dead_code)]
2use std::fmt;
3
4pub type Result<T> = std::result::Result<T, HttpError>;
5
6#[derive(Debug, Clone)]
7pub struct HttpError;
8
9impl fmt::Display for HttpError {
10    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11        write!(f, "Http exception when making request.")
12    }
13}
14
15pub type InternalResult<T> = std::result::Result<T, InternalError>;
16
17#[derive(Debug, Clone)]
18pub struct InternalError;
19
20impl fmt::Display for InternalError {
21    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22        write!(f, "Internal library error.")
23    }
24}
25
26pub type AuthorizationResult<T> = std::result::Result<T, AuthorizationCodeError>;
27
28#[derive(Debug, Clone)]
29pub struct AuthorizationCodeError;
30
31impl fmt::Display for AuthorizationCodeError {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        write!(f, "Invalid exchange code")
34    }
35}
36
37pub type RefreshTokenResult<T> = std::result::Result<T, RefreshTokenError>;
38
39#[derive(Debug, Clone)]
40pub struct RefreshTokenError;
41
42impl fmt::Display for RefreshTokenError {
43    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
44        write!(f, "Invalid exchange code")
45    }
46}