Skip to content

Commit

Permalink
Chore: Add try-catch to be safe
Browse files Browse the repository at this point in the history
  • Loading branch information
chakflying committed Jan 27, 2024
1 parent 9977f6a commit c91e03c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ class Monitor extends BeanModel {

// convert data to object
if (typeof data === "string" && res.headers["content-type"] !== "application/json") {
data = JSON.parse(data);
try {
data = JSON.parse(data);
} catch (_) {
// Failed to parse as JSON, just process it as a string
}
}

let expression = jsonata(this.jsonPath);
Expand Down

0 comments on commit c91e03c

Please sign in to comment.