Initial scaffold: Rust server workspace (sb-api, sb-core, sb-db, sb-auth, sb-shared) + sb-common dependency + systemd
This commit is contained in:
commit
7a75a523f0
39 changed files with 183 additions and 0 deletions
9
crates/sb-shared/Cargo.toml
Normal file
9
crates/sb-shared/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "sb-shared"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
thiserror = "2"
|
||||
15
crates/sb-shared/src/errors.rs
Normal file
15
crates/sb-shared/src/errors.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AppError {
|
||||
pub code: String,
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for AppError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}: {}", self.code, self.message)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for AppError {}
|
||||
3
crates/sb-shared/src/lib.rs
Normal file
3
crates/sb-shared/src/lib.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
pub mod errors;
|
||||
|
||||
pub use errors::AppError;
|
||||
Loading…
Add table
Add a link
Reference in a new issue