Skip to content

Commit 38e0b4d

Browse files
Copilotlachieh
andcommitted
Fix code review feedback: simplify error handling and remove redundant default
Co-authored-by: lachieh <1687902+lachieh@users.noreply.github.com>
1 parent 40fc85e commit 38e0b4d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

packages/lattice-client-core/src/connection/nats-ws-lattice-connection.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class NatsWsLatticeConnection implements LatticeConnection<Options> {
9090
subject: string,
9191
data?: Uint8Array | string | undefined,
9292
): Promise<Response> {
93-
const maxRetries = this.#options.retryCount ?? 3;
93+
const maxRetries = this.#options.retryCount ?? 0;
9494
let lastError: Error | undefined;
9595

9696
for (let attempt = 0; attempt <= maxRetries; attempt++) {
@@ -99,10 +99,7 @@ class NatsWsLatticeConnection implements LatticeConnection<Options> {
9999
const response = await connection.request(subject, data);
100100
return response.json<Response>();
101101
} catch (error) {
102-
lastError =
103-
error instanceof Error
104-
? error
105-
: new Error(error instanceof Error ? error.message : 'Unknown error');
102+
lastError = error instanceof Error ? error : new Error(String(error));
106103

107104
// Don't retry on the last attempt
108105
if (attempt < maxRetries) {

0 commit comments

Comments
 (0)