Hi
I a executing below code, the exception should have be handled by the try catch block but still it is crashing with error
Exception: unknown bsoncxx error code
terminate called after throwing an instance of ‘bsoncxx::v_noabi::exception’
** what(): Empty JSON string: could not parse JSON document**
Can someone suggest any solution.
try
{
bsoncxx::document::value document = bsoncxx::builder::basic::make_document
(
kvp("alert_id", alert.getId()),
kvp("alert_date", (int64_t) alert.getDate()),
kvp("alert_timestamp", datetime),
kvp("alert_args", alert.outputParams()),
kvp("alert_severity", (int32_t) alert.getSourceSeverity()),
kvp("alert_src_process", " "),
kvp("alert_src_pid", (int64_t) alert.getPid()),
kvp("alert_src_tid", 0),
kvp("alert_created_time", datetime),
kvp("alert_last_modified_time",datetime),
kvp("alert_last_modified_user"," ")
);
insertq << "ft_alert_log";
insertq << Alert::mongo_delimiter;
insertq << bsoncxx::to_json(document.view());
} catch(const bsoncxx::v_noabi::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
}
Thanks