-
Notifications
You must be signed in to change notification settings - Fork 337
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
Error message type naming collision #987
Comments
Yeah, we're probably just missing the prefix; can you paste ~5-10 lines of code that show the |
Sure thing! Here's a sample of what gets generated for export const Int64Value = {
encode(message: Int64Value, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.value !== BigInt("0")) {
if (BigInt.asIntN(64, message.value) !== message.value) {
throw new Error("value provided for field message.value of type int64 too large");
}
writer.uint32(8).int64(message.value.toString());
}
return writer;
}, And here is a sample of the syntax = "proto3";
package myapp.common.v1;
import "google/protobuf/struct.proto";
message Error {
string code = 1;
string message = 2;
google.protobuf.Struct extra = 3;
} This simple diff: if (BigInt.asUintN(64, message.positiveIntValue) !== message.positiveIntValue) {
- throw new Error("value provided for field message.positiveIntValue of type uint64 too large");
+ throw new globalThis.Error("value provided for field message.positiveIntValue of type uint64 too large");
} Is enough to get rid of |
🎉 This issue has been resolved in version 1.166.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thank you so much for the quick fix @stephenh! 🙏 I'll give this a try on Monday and report back if there are any issues. |
Works great, thank you again @stephenh 🎉 |
Hello, similar to #927, I'm running into an issue because we have a type named
Error
which gets imported in generated structs, causing a collision withthrow new Error(...)
calls in the code. The typescript errors appear to go away if I prefix these likethrow new globalThis.Error(...)
.Looks like this is one more global type which needs such a prefix added throughout?
The text was updated successfully, but these errors were encountered: