diff --git a/torn-key-pool/Cargo.toml b/torn-key-pool/Cargo.toml index 3fc246e..41ac733 100644 --- a/torn-key-pool/Cargo.toml +++ b/torn-key-pool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-key-pool" -version = "0.6.2" +version = "0.7.0" edition = "2021" authors = ["Pyrit [2111649]"] license = "MIT" diff --git a/torn-key-pool/src/lib.rs b/torn-key-pool/src/lib.rs index e942a3c..8a8d09b 100644 --- a/torn-key-pool/src/lib.rs +++ b/torn-key-pool/src/lib.rs @@ -29,6 +29,20 @@ where Response(ResponseError), } +impl KeyPoolError +where + S: std::error::Error, + C: std::error::Error, +{ + #[inline(always)] + pub fn api_code(&self) -> Option { + match self { + Self::Response(why) => why.api_code(), + _ => None, + } + } +} + pub trait ApiKey: Sync + Send + std::fmt::Debug + Clone { type IdType: PartialEq + Eq + std::hash::Hash + Send + Sync + std::fmt::Debug + Clone; diff --git a/torn-key-pool/src/postgres.rs b/torn-key-pool/src/postgres.rs index c05997a..8899259 100644 --- a/torn-key-pool/src/postgres.rs +++ b/torn-key-pool/src/postgres.rs @@ -1,4 +1,4 @@ - +use async_trait::async_trait; use indoc::indoc; use sqlx::{FromRow, PgPool, Postgres, QueryBuilder}; use thiserror::Error;