Skip to content

Commit

Permalink
fix(worker): use grpc-web RpcError instead of Error
Browse files Browse the repository at this point in the history
  • Loading branch information
smnbbrv committed Mar 1, 2022
1 parent 4840401 commit 88c0e01
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@angular/router": "^13.2.3",
"@improbable-eng/grpc-web": "^0.14.0",
"google-protobuf": "^3.15.8",
"grpc-web": "^1.2.1",
"grpc-web": "^1.3.0",
"rxjs": "^6.6.3",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/worker/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Error, Metadata, Status } from 'grpc-web';
import { RpcError, Metadata, Status } from 'grpc-web';
import { GrpcWorkerClientSettings } from './client-settings';

/* eslint-disable @typescript-eslint/no-namespace */
Expand Down Expand Up @@ -45,7 +45,7 @@ export namespace GrpcWorkerApi {
type: GrpcWorkerMessageType.rpcResponse;
responseType: GrpcWorkerMessageRPCResponseType;
id: number;
error?: Error;
error?: RpcError;
status?: Status;
response?: S;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/worker/src/lib/grpc-worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GrpcCallType, GrpcMessage } from '@ngx-grpc/common';
import { Error, GrpcWebClientBase, MethodDescriptor, Status } from 'grpc-web';
import { RpcError, GrpcWebClientBase, MethodDescriptor, Status } from 'grpc-web';
import { GrpcWorkerApi } from './api';
import { GrpcWorkerClientSettings } from './client-settings';
import { GrpcWorkerServiceClientDef } from './service-client-def';
Expand Down Expand Up @@ -124,7 +124,7 @@ export class GrpcWorker {
} else if (type === GrpcCallType.serverStream) {
const stream = service.client.serverStreaming(url, request, metadata, descriptor);

stream.on('error', (error: Error) => {
stream.on('error', (error: RpcError) => {
this.requestCancelHandlers.delete(message.id);
respond({ responseType: GrpcWorkerApi.GrpcWorkerMessageRPCResponseType.error, error });
});
Expand Down

0 comments on commit 88c0e01

Please sign in to comment.