ts-proto 1.119.0 → 1.120.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.120.0](https://github.com/stephenh/ts-proto/compare/v1.119.0...v1.120.0) (2022-07-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * add meta-data to stream error ([#620](https://github.com/stephenh/ts-proto/issues/620)) ([b68f301](https://github.com/stephenh/ts-proto/commit/b68f301b5fb4222a3fce676a7e5036cf00e77e11))
7
+
1
8
  # [1.119.0](https://github.com/stephenh/ts-proto/compare/v1.118.0...v1.119.0) (2022-07-21)
2
9
 
3
10
 
@@ -300,13 +300,16 @@ function createInvokeMethod(ctx) {
300
300
  metadata: maybeCombinedMetadata,
301
301
  debug: this.options.debug,
302
302
  onMessage: (next) => observer.next(next),
303
- onEnd: (code: ${grpc}.Code, message: string) => {
303
+ onEnd: (code: ${grpc}.Code, message: string, trailers: ${grpc}.Metadata) => {
304
304
  if (code === 0) {
305
305
  observer.complete();
306
306
  } else if (upStreamCodes.includes(code)) {
307
307
  setTimeout(upStream, DEFAULT_TIMEOUT_TIME);
308
308
  } else {
309
- observer.error(new Error(\`Error \${code} \${message}\`));
309
+ const err = new Error(message) as any;
310
+ err.code = code;
311
+ err.metadata = trailers;
312
+ observer.error(err);
310
313
  }
311
314
  },
312
315
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.119.0",
3
+ "version": "1.120.0",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",