Skip to content

Commit

Permalink
sentry breadcrumbs for testing smartapi
Browse files Browse the repository at this point in the history
  • Loading branch information
rjawesome committed Jun 20, 2024
1 parent c69f671 commit 9449fc3
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/controllers/cron/test_smartapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,32 @@ export default function testSmartApi() {
}
else {
debug(`Testing SmartAPI specs failed. ${results.errors.length} operations failed (${results.opsCount} tested).`);
const recMissingList = [];
results.errors.forEach(err => {
debug(`${err.op}: ${err.issue.message}${err.issue.message = "Record is missing" ? "" : "\n"+err.issue.stack}`);
Telemetry.captureException(err.issue);
debug(`${err.op}: ${err.issue.message}${err.issue.message == "Record is missing" ? "" : "\n"+err.issue.stack}`);
if (err.issue.message == "Record is missing") {
recMissingList.push(err.op);
} else {
Telemetry.addBreadcrumb({
type: 'error',
data: {
op: err.op
},
message: 'SmartAPI Operation Failed!'
});
Telemetry.captureException(err.issue);
}
});
if (recMissingList.length > 0) {
Telemetry.addBreadcrumb({
type: 'error',
data: {
missingRecords: recMissingList
},
message: 'Records Missing for SmartAPI Operations!'
});
Telemetry.captureException(new Error(`Records missing for SmartAPI operations`));
}
}
} catch (err) {
debug(`Testing SmartAPI specs failed! The error message is ${err.toString()}`);
Expand Down

0 comments on commit 9449fc3

Please sign in to comment.