Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(log/api): separate unexpected and expected logs #5624

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions framework/src/main/java/org/tron/core/services/RpcApiService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2475,9 +2475,13 @@ public void createShieldedContractParameters(
ShieldedTRC20Parameters shieldedTRC20Parameters = wallet
.createShieldedContractParameters(request);
responseObserver.onNext(shieldedTRC20Parameters);
} catch (ZksnarkException | ContractValidateException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of separating exceptions?

According to PR and issue, the purpose is not very clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unknown exception stacks need to be printed so that you can track down the problem easily.

responseObserver.onError(getRunTimeException(e));
logger.info("createShieldedContractParameters: {}", e.getMessage());
return;
} catch (Exception e) {
responseObserver.onError(getRunTimeException(e));
logger.info("createShieldedContractParameters exception caught: " + e.getMessage());
logger.error("createShieldedContractParameters: ", e);
return;
}
responseObserver.onCompleted();
Expand Down Expand Up @@ -2518,9 +2522,13 @@ public void scanShieldedTRC20NotesByIvk(
request.getNk().toByteArray(),
request.getEventsList());
responseObserver.onNext(decryptNotes);
} catch (BadItemException | ZksnarkException e) {
responseObserver.onError(getRunTimeException(e));
logger.info("scanShieldedTRC20NotesByIvk: {}", e.getMessage());
return;
} catch (Exception e) {
responseObserver.onError(getRunTimeException(e));
logger.info("scanShieldedTRC20NotesByIvk exception caught: " + e.getMessage());
logger.error("scanShieldedTRC20NotesByIvk:", e);
return;
}
responseObserver.onCompleted();
Expand Down