fix: MongoDB monitor JSON.parse error handling (#6778)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
pull/6777/head^2
Angel98518 3 months ago committed by GitHub
parent 9169a647cb
commit f1d3e9adcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1857,6 +1857,15 @@ class Monitor extends BeanModel {
}
}
}
if (this.type === "mongodb" && this.databaseQuery) {
// Validate that databaseQuery is valid JSON
try {
JSON.parse(this.databaseQuery);
} catch (error) {
throw new Error(`Invalid JSON in database query: ${error.message}`);
}
}
}
/**

Loading…
Cancel
Save