Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/grpc-js/src/retrying-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export class RetryingCall implements Call, DeadlineInfoProvider {
return list.some(
value =>
value === code ||
value.toString().toLowerCase() === Status[code].toLowerCase()
value.toString().toLowerCase() === Status[code]?.toLowerCase()
);
}

Expand Down
16 changes: 16 additions & 0 deletions packages/grpc-js/test/test-retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@ describe('Retries', () => {
}
);
});

it('Should not retry on custom error code', done => {
const metadata = new grpc.Metadata();
metadata.set('succeed-on-retry-attempt', '2');
metadata.set('respond-with-status', '300');
client.echo(
{ value: 'test value', value2: 3 },
metadata,
(error: grpc.ServiceError, response: any) => {
assert(error);
assert.strictEqual(error.code, 300);
assert.strictEqual(error.details, 'Failed on retry 0');
done();
}
);
});
});

describe('Client with hedging configured', () => {
Expand Down