Skip to content

Commit 9dfc038

Browse files
mads-hartmannroboquat
authored andcommitted
Only end the span if it exists
1 parent f09b44a commit 9dfc038

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.werft/util/werft.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ export class Werft {
7171
*/
7272
public fail(slice, err) {
7373
const span = this.sliceSpans[slice];
74+
75+
if (span) {
76+
span.end()
77+
} else {
78+
console.log(`[${slice}] tracing warning: No slice span by name ${slice}`)
79+
}
80+
7481
// Set the status on the span for the slice and also propagate the status to the phase and root span
7582
// as well so we can query on all phases that had an error regardless of which slice produced the error.
7683
[span, this.rootSpan, this.currentPhaseSpan].forEach((span: Span) => {
@@ -83,8 +90,6 @@ export class Werft {
8390
})
8491
})
8592

86-
span.end()
87-
8893
console.log(`[${slice}|FAIL] ${err}`);
8994
throw err;
9095
}

0 commit comments

Comments
 (0)