starpc 0.36.2 → 0.36.3

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.
@@ -148,7 +148,12 @@ export class CommonRPC {
148
148
  }
149
149
  this.closed = err ?? true;
150
150
  // note: this does nothing if _source is already ended.
151
- await this.writeCallCancel();
151
+ if (err && err.message) {
152
+ await this.writeCallData(undefined, true, err.message);
153
+ }
154
+ else {
155
+ await this.writeCallCancel();
156
+ }
152
157
  this._source.end();
153
158
  this._rpcDataSource.end(err);
154
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.36.2",
3
+ "version": "0.36.3",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -116,7 +116,7 @@ func (c *commonRPC) ReadOne() ([]byte, error) {
116
116
 
117
117
  // WriteCallData writes a call data packet.
118
118
  func (c *commonRPC) WriteCallData(data []byte, complete bool, err error) error {
119
- outPkt := NewCallDataPacket(data, len(data) == 0, false, nil)
119
+ outPkt := NewCallDataPacket(data, len(data) == 0, complete, err)
120
120
  return c.writer.WritePacket(outPkt)
121
121
  }
122
122
 
@@ -176,7 +176,11 @@ export class CommonRPC {
176
176
  }
177
177
  this.closed = err ?? true
178
178
  // note: this does nothing if _source is already ended.
179
- await this.writeCallCancel()
179
+ if (err && err.message) {
180
+ await this.writeCallData(undefined, true, err.message)
181
+ } else {
182
+ await this.writeCallCancel()
183
+ }
180
184
  this._source.end()
181
185
  this._rpcDataSource.end(err)
182
186
  }