mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 13:52:11 +00:00
errors
This commit is contained in:
1 parent
30daca8462
commit
7febc6a1d8
5 files changed
+66
No files matched your search
@@ -0,0 +1,14 @@
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ApiError {
|
||||
}
|
||||
|
||||
impl Display for ApiError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for ApiError {}
|
||||
@@ -0,0 +1,14 @@
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ClientError {
|
||||
}
|
||||
|
||||
impl Display for ClientError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for ClientError {}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod client_error;
|
||||
pub mod api_error;
|
||||
pub mod runwayml_error;
|
||||
@@ -0,0 +1,33 @@
|
||||
use crate::error::api_error::ApiError;
|
||||
use crate::error::client_error::ClientError;
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum RunwayMlError {
|
||||
Api(ApiError),
|
||||
Client(ClientError),
|
||||
}
|
||||
|
||||
impl Display for RunwayMlError{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Api(err) => write!(f, "ApiError: {}", err),
|
||||
Self::Client(err) => write!(f, "ClientError: {}", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for RunwayMlError {}
|
||||
|
||||
impl From<ApiError> for RunwayMlError {
|
||||
fn from(err: ApiError) -> Self {
|
||||
RunwayMlError::Api(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ClientError> for RunwayMlError {
|
||||
fn from(err: ClientError) -> Self {
|
||||
RunwayMlError::Client(err)
|
||||
}
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
/// TODO DOCS
|
||||
|
||||
pub mod error;
|
||||
Reference in new issue
Block a user