Skip to content

Commit

Permalink
fix: ensure onError is only called once
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc committed Aug 9, 2024
1 parent 831e170 commit aef7d15
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ export abstract class OTLPExporterBrowserBase<
.then(response => {
if (response.status === 'success') {
onSuccess();
return;
}
if (response.status === 'failure' && response.error) {
} else if (response.status === 'failure' && response.error) {
onError(response.error);
}
if (response.status === 'retryable') {
} else if (response.status === 'retryable') {
onError(new OTLPExporterError('Export failed with retryable status'));
} else {
onError(new OTLPExporterError('Export failed with unknown error'));
}
onError(new OTLPExporterError('Export failed with unknown error'));
}, onError);

this._sendingPromises.push(promise);
Expand Down

0 comments on commit aef7d15

Please sign in to comment.