api: add structured context for service errors
This commit is contained in:
@@ -90,21 +90,21 @@ impl ApiError {
|
||||
}
|
||||
}
|
||||
|
||||
fn validation_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
pub(crate) fn validation_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
Self::Validation {
|
||||
message: message.into(),
|
||||
context: Some(context),
|
||||
}
|
||||
}
|
||||
|
||||
fn not_found_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
pub(crate) fn not_found_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
Self::NotFound {
|
||||
message: message.into(),
|
||||
context: Some(context),
|
||||
}
|
||||
}
|
||||
|
||||
fn conflict_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
pub(crate) fn conflict_with_context(message: impl Into<String>, context: Value) -> Self {
|
||||
Self::Conflict {
|
||||
message: message.into(),
|
||||
context: Some(context),
|
||||
|
||||
Reference in New Issue
Block a user