Skip to content

Commit

Permalink
Merge pull request #140 from mercedes-benz/VULCAN-819/OverloadIssue
Browse files Browse the repository at this point in the history
inactive or access token failure
  • Loading branch information
brahmprakashMishra authored Sep 23, 2024
2 parents c280efc + ee8f658 commit 9bb0502
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/report/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ export const NeoReport = ({
);
} else if (status == QueryStatus.OVER_LOAD) {
return <NeoCodeViewerComponent value={`Loading took too long. Please reload report or complete page.`} />;
} else if (status == QueryStatus.INACTIVE) {
return <NeoCodeViewerComponent value={`Access token timed out. Please reload report or complete page.`} />;
}
return (
<NeoCodeViewerComponent
Expand Down
8 changes: 8 additions & 0 deletions src/report/ReportQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum QueryStatus {
COMPLETE, // There is data returned, and we can visualize it all.
COMPLETE_TRUNCATED, // There is data returned, but it's too much so we truncate it.
ERROR, // Something broke, likely the cypher query is invalid.
INACTIVE, // If dashboard is inactive for too long and we use a custom message instead of error message from backend. (VULCAN-819)
}

// TODO: create a readOnly version of this method or inject a property
Expand Down Expand Up @@ -151,6 +152,13 @@ export async function runCypherQuery(
return 'Loading took too long. Please reload page.';
}

if (e.message.startsWith('WebSocket connection failure.')) {
setStatus(QueryStatus.INACTIVE);
setRecords([{ error: 'Access token timed out. Please reload report or complete page.' }]);
transaction.rollback();
return 'Access token timed out. Please reload report or complete page.';
}

setStatus(QueryStatus.ERROR);
// Process other errors.
if (setRecords) {
Expand Down

0 comments on commit 9bb0502

Please sign in to comment.