-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from IABTechLab/ajy-UID2-2599-Update-unexpect…
…ed-error-copy Update unexpected error copy
- Loading branch information
Showing
7 changed files
with
73 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import ErrorView from './ErrorView'; | ||
|
||
import '../../utils/errorHandler.scss'; | ||
|
||
const meta: Meta<typeof ErrorView> = { | ||
component: ErrorView, | ||
title: 'Shared Components/Error View', | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof ErrorView>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const WithErrorId: Story = { | ||
args: { | ||
errorId: 'this is an errorId', | ||
}, | ||
}; | ||
|
||
export const WithErrorHash: Story = { | ||
args: { | ||
errorHash: 'this is an errorHash', | ||
}, | ||
}; | ||
|
||
export const WithErrorIdAndMessage: Story = { | ||
args: { | ||
message: 'this is a custom error message', | ||
errorId: 'this is an errorId', | ||
}, | ||
}; | ||
|
||
export const WithErrorIdAndErrorHash: Story = { | ||
args: { | ||
errorId: '1234-5678-abcd-efgh', | ||
errorHash: 'this is an errorHash', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { analyticsIdentifier } from '../../utils/errorHelpers'; | ||
|
||
type ErrorViewProps = { | ||
message?: string; | ||
errorId?: string; | ||
errorHash?: string; | ||
}; | ||
|
||
function ErrorView({ message, errorId, errorHash }: ErrorViewProps) { | ||
return ( | ||
<div className='error-content'> | ||
<img alt='Error icon' src='/uid2-logo.png' /> | ||
<div>Error</div> | ||
<div> | ||
{message ?? | ||
'There was an unexpected error. Please try again. If the problem persists, contact Support and provide the following information: '} | ||
</div> | ||
<div>({analyticsIdentifier(errorId, errorHash)})</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default ErrorView; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const analyticsIdentifier = (errorId?: string, errorHash?: string) => { | ||
if (!errorHash && !errorId) return 'No error identifier'; | ||
return errorHash | ||
? `error hash: ${errorHash}` // From backend | ||
: `error ID: ${errorId}`; // Generated by frontend to make it possible to triage user reported errors. | ||
}; |