Skip to content

Commit

Permalink
Merge pull request #539 from USEPA/feature/update-bap-connection-erro…
Browse files Browse the repository at this point in the history
…r-handling

Feature/update bap connection error handling
  • Loading branch information
courtneymyers authored Jan 24, 2025
2 parents 5f4efe0 + fa32133 commit bff90e1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/server/app/utilities/bap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1927,13 +1927,12 @@ function verifyBapConnection(req, { name, args }) {
const logMessage = `BAP Error: ${err}.`;
log({ level: "error", message: logMessage, req, otherInfo: err });

// TODO: Handle the following error:
// Error: Unable to refresh session due to: No refresh token found in the connection.
const errorMessage = err?.message || err;

if (err?.includes("No refresh token found in the connection.")) {
if (errorMessage?.includes("No refresh token found in the connection")) {
log({ level: "info", message: "Re-establishing BAP connection.", req });

// Re-establish the BAP connection.
return setupConnection(req).then(() => callback());
}

throw err;
Expand Down

0 comments on commit bff90e1

Please sign in to comment.