feat(errors): add stable error propagation

This commit is contained in:
Onur Özkan committed 2026-08-23 00:40:17 +03:00
1 parent 97acb2a2d7
commit ba9c97ed3b
34 files changed
+1007

No files matched your search

@@ -0,0 +1,37 @@
extern crate self as kaptan_err_propagate;
use kaptan_err_propagate_macros::KaptanError;
#[derive(Clone, Copy)]
pub struct ErrorId(u16);
impl ErrorId {
pub const fn new(id: u16) -> Self {
Self(id)
}
pub const fn get(self) -> u16 {
self.0
}
}
pub trait ErrorReport {
fn error_id(&self) -> ErrorId;
}
#[derive(Debug, KaptanError)]
enum FirstError {
#[kaptan_error(id = 77)]
Failed,
}
#[derive(Debug, KaptanError)]
enum SecondError {
#[kaptan_error(id = 77)]
Failed,
}
fn main() {
let _ = FirstError::Failed.error_id();
let _ = SecondError::Failed.error_id();
}