Skip to content

Commit

Permalink
fix: handle JSON parsing error in log_pg_item_serv.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
RWDai committed Jan 3, 2025
1 parent 8196d65 commit 94b0d92
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/spi/spi-log/src/serv/pg/log_pg_item_serv.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tardis::{
basic::{dto::TardisContext, result::TardisResult},
db::{reldb_client::TardisRelDBClient, sea_orm::Value},
serde_json::Value as JsonValue,
serde_json::{json, Value as JsonValue},
web::web_resp::TardisPage,
TardisFuns, TardisFunsInst,
};
Expand Down Expand Up @@ -489,7 +489,10 @@ ORDER BY ts DESC
total_size = item.try_get("", "total")?;
}
let content: String = item.try_get("", "content")?;
let content = TardisFuns::json.str_to_json(&content)?;
let content = match TardisFuns::json.str_to_json(&content) {
Ok(content) => content,
Err(_) => json!({"content": content}),
};
Ok(LogItemFindResp {
ts: item.try_get("", "ts")?,
id: item.try_get("", "id")?,
Expand Down

0 comments on commit 94b0d92

Please sign in to comment.