Skip to content

Commit

Permalink
undo change in makeCall
Browse files Browse the repository at this point in the history
  • Loading branch information
aikoven committed Oct 14, 2023
1 parent 629ed12 commit 391d185
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/nice-grpc-web/src/client/makeCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ export async function* makeCall<Request, Response>(

try {
yield* response;

if (status != null && status !== Status.OK) {
throw new ClientError(definition.path, status, message ?? '');
}

if (status == null) {
throw new ClientError(
definition.path,
Status.UNKNOWN,
'Response stream closed without gRPC status',
);
}
} catch (err) {
if (requestError !== undefined) {
throw requestError.err;
Expand All @@ -147,6 +135,17 @@ export async function* makeCall<Request, Response>(
} finally {
finished = true;
signal.removeEventListener('abort', abortListener);
innerAbortController.abort();

if (status != null && status !== Status.OK) {
throw new ClientError(definition.path, status, message ?? '');
}
}

if (status == null) {
throw new ClientError(
definition.path,
Status.UNKNOWN,
'Response stream closed without gRPC status',
);
}
}

0 comments on commit 391d185

Please sign in to comment.