Skip to content

Commit

Permalink
feat: add ray id to error body
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato authored and NathanFlurry committed May 31, 2024
1 parent 386d532 commit 39d698b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions fern/definition/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ types:
properties:
code: string
message: string
ray_id: string
documentation: optional<string>
metadata: optional<ErrorMetadata>
4 changes: 3 additions & 1 deletion lib/api-helper/build/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct ErrorReply {
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
pub message: String,
pub ray_id: Uuid,
#[serde(skip_serializing_if = "Option::is_none")]
pub documentation: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -42,7 +43,7 @@ pub fn handle_rejection(
} else {
err_code!(
ERROR,
error = format!("An internal error has occurred (ray_id {}).", ray_id)
error = "An internal error has occurred.",
)
}
}
Expand Down Expand Up @@ -98,6 +99,7 @@ pub fn handle_rejection(
let error_reply = ErrorReply {
code,
message,
ray_id,
documentation,
metadata,
};
Expand Down

0 comments on commit 39d698b

Please sign in to comment.