Add custom error

This commit is contained in:
Dongri Jin
2023-03-05 07:37:39 +09:00
parent 95bef4a7b8
commit d3223befbd
5 changed files with 53 additions and 32 deletions

15
src/v1/error.rs Normal file
View File

@@ -0,0 +1,15 @@
use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub struct APIError {
pub message: String,
}
impl fmt::Display for APIError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "APIError: {}", self.message)
}
}
impl Error for APIError {}