refactor: update API response for JSON deserialization errors (#6610)

This commit is contained in:
Kashif
2024-11-22 02:59:37 +05:30
committed by GitHub
parent 9010214c6e
commit 40d3c38b83
6 changed files with 81 additions and 28 deletions

View File

@ -81,7 +81,11 @@ pub mod error_parser {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
serde_json::to_string(&serde_json::json!({
"error": self.err.to_string()
"error": {
"error_type": "invalid_request",
"message": self.err.to_string(),
"code": "IR_06",
}
}))
.as_deref()
.unwrap_or("Invalid Json Error"),