-
Notifications
You must be signed in to change notification settings - Fork 13
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
Abhi132004 patch 3 #45
Closed
Abhi132004
wants to merge
16
commits into
ballerina-platform:main
from
Abhi132004:Abhi132004-patch-3
Closed
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1562ac1
Update GrpcCmd.java
Abhi132004 e76fef2
Merge pull request #1 from Abhi132004/Abhi132004-patch-1
Abhi132004 eb4fc2b
Update protoc-cli/src/main/java/io/ballerina/protoc/protobuf/cmd/Grpc…
Abhi132004 2e0b394
Update protoc-cli/src/main/java/io/ballerina/protoc/protobuf/cmd/Grpc…
Abhi132004 870b7da
Update protoc-cli/src/main/java/io/ballerina/protoc/protobuf/cmd/Grpc…
Abhi132004 edb5e32
Update GrpcCmd.java
Abhi132004 5be0a1f
Merge pull request #2 from Abhi132004/Abhi132004-patch-2
Abhi132004 4f51ab3
Update GrpcCmd.java
Abhi132004 523ee13
Update GrpcCmd.java
Abhi132004 949a08e
Update GrpcCmd.java
Abhi132004 470a80a
Update GrpcCmd.java
Abhi132004 771f52f
Merge branch 'main' into Abhi132004-patch-3
Abhi132004 f0a7c7d
Merge branch 'main' into Abhi132004-patch-3
Abhi132004 3f900a7
Update GrpcCmd.java
Abhi132004 62bbb57
Update GrpcCmd.java
Abhi132004 2637b4d
Update GrpcCmd.java
Abhi132004 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we do a catch here, the error is logged elsewhere and also printed to the stdout. The exception is not thrown to here. Hence, this catch will not be able to catch it. We need to remove the log with the stacktrace and display a reason for the failure if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch (Exception e) {
// Handle the exception and print a user-friendly error message
handleException(e);
}
}
private void handleException(Exception e) {
// Log the exception or print a user-friendly error message
// If you want to suppress the stack trace, you can just print a custom error message here
outStream.println("Error: " + e.getMessage());
}
In this modified code, the catch block in the execute method calls a handleException method, which you can customize to log the exception, print an error message, or suppress the stack trace as needed. This allows you to have control over how the exception is handled without the default stack trace logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dilanSachi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Abhi132004. It seems you have not understood what I meant in my comment. Let me try and explaing a bit more. The issue is related to the
generateBalFile
method. In this method, when there are errors in the descriptor generator phase, they are caught as aCodeGeneratorException
in here [1]. However, we have only printed a generic error and the error message. But this prints stack traces as well. What we need to do is to check if we can add any error information to this printed error and try and stop the stack trace printing in the cmd.[1]
protoc-tools/protoc-cli/src/main/java/io/ballerina/protoc/protobuf/cmd/GrpcCmd.java
Line 265 in 6db60af