Skip to content

Commit

Permalink
Don't catch exceptions in service methods
Browse files Browse the repository at this point in the history
It makes handling exceptions in interceptors hard. On the other hand, if there is no interceptor catching StatusRuntimeException the response status is UNKNOWN.
  • Loading branch information
Duzhinsky committed Oct 19, 2023
1 parent 81efd60 commit 44c62b8
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ private TypeModel responseTypeModel() {
@NotNull
private CodeBlock generateBody() {
return CodeBlock.of("""
try {
$>$L$<
} catch (Throwable $$t) { responseObserver.onError($$t); }
finally { responseObserver.onCompleted(); }
""", generateAbstractMethodCall());
$L
responseObserver.onCompleted();
""",
generateAbstractMethodCall()
);
}

private CodeBlock generateAbstractMethodCall() {
Expand Down

0 comments on commit 44c62b8

Please sign in to comment.