datadog-ci
datadog-ci copied to clipboard
[SYNTH-16108] Show error stack trace and cause
What and why?
Before:
$ yarn launch synthetics run-tests -s 'test:('
ERROR: unable to obtain test configurations with search query
Request failed with status code 400
After:
$ yarn launch synthetics run-tests -s 'test:('
ERROR: unable to obtain test configurations
CriticalError: Failed to search tests with query: query on https://api.datadoghq.com/api/v1/synthetics/tests/search returned: "Make sure there is no missing parentheses"
at /Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/synthetics/run-tests-lib.ts:85:11
at Generator.throw (<anonymous>)
at rejected (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/synthetics/run-tests-lib.ts:6:65)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'UNAVAILABLE_TEST_CONFIG',
[cause]: EndpointError: Failed to search tests with query: query on https://api.datadoghq.com/api/v1/synthetics/tests/search returned: "Make sure there is no missing parentheses"
at /Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/synthetics/test.ts:81:11
at Generator.throw (<anonymous>)
at rejected (/Users/corentin.girard/go/src/github.com/DataDog/datadog-ci.git/master/src/commands/synthetics/test.ts:6:65)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 400
}
}
How?
For each error that we catch and want to re-throw, we now attach it as a cause on the new error.
Review checklist
- [x] Feature or bugfix MUST have appropriate tests (unit, integration)
Datadog Report
Branch report: corentin.girard/SYNTH-16108/show-error-stack-trace-with-cause
Commit report: 75d69b8
Test service: datadog-ci-tests
:white_check_mark: 0 Failed, 416 Passed, 0 Skipped, 52.78s Total duration (2m 34.9s time saved)