Skip to content

Commit 167a8bf

Browse files
committed
fix: moved this.reset() to a finally block to guarantee cleanup even if the send operation fails.
1 parent 24a17ac commit 167a8bf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/endpoints/email.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,11 @@ export class EmailEndpoint extends Endpoint {
338338
? { headers: { 'Idempotency-Key': this.idempotencyKeyValue } }
339339
: undefined;
340340

341-
const response = await this.httpClient.post<SendEmailResponse>('/send', this.payload, config);
342-
343-
this.reset();
344-
345-
return response;
341+
try {
342+
return await this.httpClient.post<SendEmailResponse>('/send', this.payload, config);
343+
} finally {
344+
this.reset();
345+
}
346346
}
347347

348348
/**

0 commit comments

Comments
 (0)