Skip to content

Commit 4fd4a44

Browse files
authored
fix(prop): Add prop to ErrorState (#23)
1 parent 9d085a2 commit 4fd4a44

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/module/src/ErrorState/ErrorState.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ const useStyles = createUseStyles({
2222
export interface ErrorStateProps extends Omit<EmptyStateProps, 'children'> {
2323
/** Title of the error. */
2424
errorTitle?: string;
25-
/** A description of the error, if no description is provided then it will be set to the default message. */
25+
/** A description of the error, if no description is provided then it will be set to the defaulErrorDescription. */
2626
errorDescription?: React.ReactNode;
27+
/** A default description of the error used if no description is provided. */
28+
defaulErrorDescription?: React.ReactNode;
2729
}
2830

29-
const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, ...props }: ErrorStateProps) => {
31+
const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, defaulErrorDescription = null, ...props }: ErrorStateProps) => {
3032
const classes = useStyles();
3133
return (
3234
<EmptyState variant={EmptyStateVariant.large} {...props}>
@@ -36,8 +38,7 @@ const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'So
3638
</Title>
3739
<EmptyStateBody>
3840
<Stack>
39-
{errorDescription ? <StackItem>{errorDescription}</StackItem> : <><StackItem>There was a problem processing the request. Please try again.</StackItem>
40-
<StackItem>If the problem persists, contact system support.</StackItem></>}
41+
{errorDescription ? <StackItem>{errorDescription}</StackItem> : defaulErrorDescription}
4142
</Stack>
4243
</EmptyStateBody>
4344
{document.referrer ? (

0 commit comments

Comments
 (0)