Skip to content

Commit

Permalink
Added try-finally to span finish
Browse files Browse the repository at this point in the history
  • Loading branch information
whiskeysierra committed Nov 26, 2019
1 parent 8070e93 commit 251b654
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@ public void beforeQuery(final ExecutionInfo info, final List<QueryInfo> infos) {
public void afterQuery(final ExecutionInfo info, final List<QueryInfo> queries) {
final Span span = info.getCustomValue(SPAN, Span.class);

if (!info.isSuccess()) {
final Statement statement = info.getStatement();
final Throwable error = info.getThrowable();

decorator.onError(span, statement, error);
try {
if (!info.isSuccess()) {
final Statement statement = info.getStatement();
final Throwable error = info.getThrowable();

decorator.onError(span, statement, error);
}
} finally {
span.finish();
}

span.finish();
}

}

0 comments on commit 251b654

Please sign in to comment.