Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-el committed Nov 16, 2023
1 parent 45b56fd commit a2a0eb2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions libraries/browser-tracker-core/src/tracker/out_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,9 @@ export function OutQueueManager(
return typeof queue[0] === 'object' && 'evt' in queue[0];
};

// Runs `onRequestFailure` callback if defined, and clears the current batch
const tryOnRequestFailure = (status: number, message: string, batch: EventBatch) => {
onRequestFailure?.({
events: batch,
status,
message,
});
// Runs `onRequestFailure` callback if defined
const tryOnRequestFailure = (status: number, message: string, events: EventBatch) => {
onRequestFailure?.({ events, status, message });
};

/**
Expand Down Expand Up @@ -452,6 +448,13 @@ export function OutQueueManager(
}
}

/**
* Determines whether a request was successful, based on its status code
* Anything in the 2xx range is considered successful
*
* @param statusCode The status code of the request
* @returns Whether the request was successful
*/
function isSuccessfulRequest(statusCode: number): boolean {
return statusCode >= 200 && statusCode < 300;
}
Expand Down

0 comments on commit a2a0eb2

Please sign in to comment.