mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-12-05 12:08:19 +00:00
Add custom error
This commit is contained in:
15
src/v1/error.rs
Normal file
15
src/v1/error.rs
Normal 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 {}
|
||||
Reference in New Issue
Block a user