-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
ballerina-platform/protoc-tools
#72Description
When the proto file is invalid, the grpc command crashes. It would be better if we can have proper error messages for the failures.
For example, in my case, the issue was I hadn't defined a type that I had used in another type:
message PaginatedUser {
int64 count = 1;
repeated User list = 2;
Pagination pagination = 3;
}
The User wasn't defined in the file. The output from the grpc command was as follows:
bal grpc --input resources/user_service.proto
Downloading the protoc executor file - protoc-3.21.7-osx-x86_64.exe
Download successfully completed. Executor file path - /var/folders/_w/76qx789d5hj633snw3c8fswr0000gp/T/protoc-3.21.7-osx-x86_64.exe
Successfully extracted the library files.
Jul 12, 2023 11:27:00 AM io.ballerina.protoc.protobuf.cmd.GrpcCmd generateBalFile
SEVERE: An error occurred when generating the proto descriptor.
io.ballerina.protoc.protobuf.exception.CodeGeneratorException: Invalid command syntax. Stream closed
at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.handleProcessExecutionErrors(BalFileGenerationUtils.java:110)
at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.generateDescriptor(BalFileGenerationUtils.java:83)
at io.ballerina.protoc.protobuf.cmd.DescriptorsGenerator.generateRootDescriptor(DescriptorsGenerator.java:148)
at io.ballerina.protoc.protobuf.cmd.GrpcCmd.generateBalFile(GrpcCmd.java:251)
at io.ballerina.protoc.protobuf.cmd.GrpcCmd.execute(GrpcCmd.java:165)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at io.ballerina.cli.launcher.Main.main(Main.java:53)
Caused by: java.io.IOException: Stream closed
at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:342)
at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.base/java.io.InputStreamReader.read(InputStreamReader.java:181)
at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
at java.base/java.io.BufferedReader.readLine(BufferedReader.java:326)
at java.base/java.io.BufferedReader.readLine(BufferedReader.java:392)
at io.ballerina.protoc.protobuf.utils.BalFileGenerationUtils.handleProcessExecutionErrors(BalFileGenerationUtils.java:105)
... 6 more
An error occurred when generating the proto descriptor. Invalid command syntax. Stream closed
This has 2 problems:
- The
grpccommand has crashed. This is not a good look to have the runtime crash. - No explanation for the failure. Only says invalid command syntax.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo