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

pbjs will not display error messages in some cases #1816

Closed
binsee opened this issue Sep 23, 2022 · 0 comments · Fixed by #1817
Closed

pbjs will not display error messages in some cases #1816

binsee opened this issue Sep 23, 2022 · 0 comments · Fixed by #1817

Comments

@binsee
Copy link
Contributor

binsee commented Sep 23, 2022

protobuf.js version: 7.1.2

The following proto files are defined here:

// 1.proto

syntax = "proto3";

package test;

import './11.proto';
import './12.proto';
// 11.proto

syntax = "proto3";

package test;

message TestMsg {
  int32 id = 1;
}
// 12.proto

syntax = "proto3";

package test;

message TestMsg {
  int32 id = 1;
  int32 id = 1;
}
  • run command
pbjs -t json -o 1.json 1.proto --sparse

The following error should be thrown in the correct case, but it is not actually displayed:

Error: duplicate name 'id' in Type TestMsg

After debugging, I think the cause of the problem may be here

protobuf.js/src/root.js

Lines 97 to 106 in d026849

function finish(err, root) {
/* istanbul ignore if */
if (!callback)
return;
var cb = callback;
callback = null;
if (sync)
throw err;
cb(err, root);
}

Errors should be shown, not eaten silently, and we should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant