Skip to content

Commit

Permalink
Catch and return all possible errors in collector. (#2782)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Aug 24, 2019
1 parent 106a21e commit 6dde6e4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, ServiceRequestConte
} catch (IllegalArgumentException e) {
result.onError(new IllegalArgumentException("Expected a " + decoder + " encoded list\n"));
return null;
} catch (Throwable t1) {
result.onError(t1);
return null;
}

SpanBytesDecoder unexpectedDecoder = testForUnexpectedFormat(decoder, nioBuffer);
Expand All @@ -159,7 +162,12 @@ HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, ServiceRequestConte
// collector.accept might block so need to move off the event loop. We make sure the
// callback is context aware to continue the trace.
Executor executor = ctx.makeContextAware(ctx.blockingTaskExecutor());
collector.acceptSpans(nioBuffer, decoder, result, executor);
try {
collector.acceptSpans(nioBuffer, decoder, result, executor);
} catch (Throwable t1) {
result.onError(t1);
return null;
}
} finally {
ReferenceCountUtil.release(content);
}
Expand Down

0 comments on commit 6dde6e4

Please sign in to comment.