Skip to content

Commit

Permalink
Only end the span if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mads-hartmann authored and roboquat committed May 13, 2022
1 parent f09b44a commit 9dfc038
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .werft/util/werft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ export class Werft {
*/
public fail(slice, err) {
const span = this.sliceSpans[slice];

if (span) {
span.end()
} else {
console.log(`[${slice}] tracing warning: No slice span by name ${slice}`)
}

// Set the status on the span for the slice and also propagate the status to the phase and root span
// as well so we can query on all phases that had an error regardless of which slice produced the error.
[span, this.rootSpan, this.currentPhaseSpan].forEach((span: Span) => {
Expand All @@ -83,8 +90,6 @@ export class Werft {
})
})

span.end()

console.log(`[${slice}|FAIL] ${err}`);
throw err;
}
Expand Down

0 comments on commit 9dfc038

Please sign in to comment.