protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

Missing import with loadSync is not thrown

Open steinybot opened this issue 3 years ago • 2 comments

protobuf.js version: 6.10.2

syntax = "proto3";

import "no/such/file.proto";

message Something {
  ImportedType field = 1;
}
root.loadSync("missing-import.proto")

This should throw an error if "no/such/file.proto" does not exist but it does not.

steinybot avatar May 16 '22 20:05 steinybot

This doesn't just apply to missing imports, this seems to apply for all syntax errors.

syntax = "proto3";

message Foo {
  string name = 1;;
}

Whether or not this is an actual syntax error.. tbd. protoc is fine with it. Regardless, protobufjs silently swallows this but with the linked MR it's bubbled up correctly.

ccakes avatar Jun 14 '22 01:06 ccakes

The issue is still present in v7.2.3 and the proposed fix works fine. Any hope this will be merged?

yrtimiD avatar Jul 30 '23 23:07 yrtimiD