From 539cb0d56b34a1f0a34f7d8494e8b0e7699cff99 Mon Sep 17 00:00:00 2001 From: Jonxslays <51417989+Jonxslays@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:28:26 -0700 Subject: [PATCH] Update error codes to match changes in the API (#27) * Update error codes * Bump project version * Update changelog --- CHANGELOG.md | 10 ++++++++++ Cargo.toml | 2 +- src/models/http.rs | 10 ++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e354bd..5dca72c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v0.2.0 (Sep 2023) + +## Additions + +- Add `NotUnique` and `InvalidKeyType` variants to `ErrorCode` enum. + +## Changes + +- Rename `UsageExceeded` error code to `KeyUsageExceeded`. + # v0.1.0 (Aug 2023) ## Additions diff --git a/Cargo.toml b/Cargo.toml index d61f8e5..4b80fe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "unkey" description = "An asynchronous Rust SDK for the Unkey API." -version = "0.1.0" +version = "0.2.0" edition = "2021" authors = ["Jonxslays"] readme = "README.md" diff --git a/src/models/http.rs b/src/models/http.rs index fb5c1d5..2203e81 100644 --- a/src/models/http.rs +++ b/src/models/http.rs @@ -22,12 +22,18 @@ pub enum ErrorCode { /// Not authorized for resource. Unauthorized, - /// You have exceeded your usage. - UsageExceeded, + /// The key has exceeded its usage. + KeyUsageExceeded, /// An internal server error occurred with the api. InternalServerError, + // An invalid key type was used (shouldn't happen usually). + InvalidKeyType, + + // The identifier is in use by another resource. + NotUnique, + /// Reserved for unknown interactions. #[serde(other)] Unknown,