diff --git a/Cargo.lock b/Cargo.lock index 4731939..eed0a1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,7 +111,7 @@ checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "burn-central-client" -version = "0.3.0" +version = "0.3.1" dependencies = [ "reqwest", "serde", @@ -2085,7 +2085,7 @@ checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "xtask" -version = "0.3.0" +version = "0.3.1" dependencies = [ "log", "tracel-xtask", diff --git a/Cargo.toml b/Cargo.toml index 023eba0..e61b927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = ["burn-central-client", "xtask"] [workspace.package] edition = "2024" -version = "0.3.0" +version = "0.3.1" authors = ["Burn central team"] homepage = "https://burn.dev" repository = "https://github.com/tracel-ai/burn-central-client" diff --git a/burn-central-client/src/client.rs b/burn-central-client/src/client.rs index ad46a0f..0beabe1 100644 --- a/burn-central-client/src/client.rs +++ b/burn-central-client/src/client.rs @@ -32,7 +32,6 @@ impl ResponseExt for reqwest::blocking::Response { match self.status() { reqwest::StatusCode::NOT_FOUND => Err(ClientError::NotFound), reqwest::StatusCode::UNAUTHORIZED => Err(ClientError::Unauthorized), - reqwest::StatusCode::FORBIDDEN => Err(ClientError::Forbidden), reqwest::StatusCode::INTERNAL_SERVER_ERROR => Err(ClientError::InternalServerError), _ => Err(ClientError::ApiError { status: self.status(), diff --git a/burn-central-client/src/error.rs b/burn-central-client/src/error.rs index 6db581d..2903489 100644 --- a/burn-central-client/src/error.rs +++ b/burn-central-client/src/error.rs @@ -9,6 +9,7 @@ use thiserror::Error; pub enum ApiErrorCode { ProjectAlreadyExists, UnsupportedSdkVersion, + LimitReached, // ... #[serde(other)] Unknown, @@ -31,7 +32,7 @@ impl Default for ApiErrorBody { impl Display for ApiErrorBody { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "Code: {}, Message: {}", self.code, self.message) + write!(f, "{}: {}", self.code, self.message) } } @@ -43,8 +44,6 @@ pub enum ClientError { NotFound, #[error("Unauthorized access")] Unauthorized, - #[error("Forbidden access")] - Forbidden, #[error("Internal server error")] InternalServerError, #[error("Api error {status}: {body}")] @@ -71,6 +70,6 @@ impl ClientError { } pub fn is_login_error(&self) -> bool { - matches!(self, ClientError::Unauthorized | ClientError::Forbidden) + matches!(self, ClientError::Unauthorized) } }