From c115d6f484e5a0ec5c6aed0f5177c3255f5ee27a Mon Sep 17 00:00:00 2001 From: MasterPtato <23087326+MasterPtato@users.noreply.github.com> Date: Sat, 1 Jun 2024 08:33:54 +0000 Subject: [PATCH] feat: add ray id to error body (#833) ## Changes --- fern/definition/common.yml | 1 + lib/api-helper/build/src/error.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fern/definition/common.yml b/fern/definition/common.yml index 82c33ea70e..5b53911831 100644 --- a/fern/definition/common.yml +++ b/fern/definition/common.yml @@ -105,5 +105,6 @@ types: properties: code: string message: string + ray_id: string documentation: optional metadata: optional diff --git a/lib/api-helper/build/src/error.rs b/lib/api-helper/build/src/error.rs index 83370e94b1..b6d3950b87 100644 --- a/lib/api-helper/build/src/error.rs +++ b/lib/api-helper/build/src/error.rs @@ -13,6 +13,7 @@ pub struct ErrorReply { #[serde(skip_serializing_if = "Option::is_none")] pub code: Option, pub message: String, + pub ray_id: Uuid, #[serde(skip_serializing_if = "Option::is_none")] pub documentation: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -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.", ) } } @@ -98,6 +99,7 @@ pub fn handle_rejection( let error_reply = ErrorReply { code, message, + ray_id, documentation, metadata, };