chore (backend-rs): remove impl_into_napi_error macro

Co-authored-by: sup39 <dev@sup39.dev>
This commit is contained in:
naskya 2024-04-12 11:42:42 +09:00
parent 6b812fb30b
commit 8926d86ab8
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
5 changed files with 0 additions and 24 deletions

View file

@ -1,7 +1,5 @@
use sea_orm::error::DbErr;
use crate::impl_into_napi_error;
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
pub enum Error {
#[error("The database connections have not been initialized yet")]
@ -9,5 +7,3 @@ pub enum Error {
#[error("ORM error: {0}")]
OrmError(#[from] DbErr),
}
impl_into_napi_error!(Error);

View file

@ -1,7 +1,6 @@
pub use macro_rs::napi as export;
pub mod database;
pub mod macros;
pub mod misc;
pub mod model;
pub mod util;

View file

@ -1,11 +0,0 @@
#[macro_export]
macro_rules! impl_into_napi_error {
($a:ty) => {
#[cfg(feature = "napi")]
impl Into<napi::Error> for $a {
fn into(self) -> napi::Error {
napi::Error::from_reason(self.to_string())
}
}
};
}

View file

@ -1,5 +1,3 @@
use crate::impl_into_napi_error;
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
pub enum Error {
#[error("Failed to parse string: {0}")]
@ -11,5 +9,3 @@ pub enum Error {
#[error("Requested entity not found")]
NotFound,
}
impl_into_napi_error!(Error);

View file

@ -6,14 +6,10 @@ use chrono::NaiveDateTime;
use once_cell::sync::OnceCell;
use std::cmp;
use crate::impl_into_napi_error;
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
#[error("ID generator has not been initialized yet")]
pub struct ErrorUninitialized;
impl_into_napi_error!(ErrorUninitialized);
static FINGERPRINT: OnceCell<String> = OnceCell::new();
static GENERATOR: OnceCell<cuid2::CuidConstructor> = OnceCell::new();