Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/module/src/ErrorState/ErrorState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const useStyles = createUseStyles({
export interface ErrorStateProps extends Omit<EmptyStateProps, 'children'> {
/** Title of the error. */
errorTitle?: string;
/** A description of the error, if no description is provided then it will be set to the default message. */
/** A description of the error, if no description is provided then it will be set to the defaulErrorDescription. */
errorDescription?: React.ReactNode;
/** A default description of the error used if no description is provided. */
defaulErrorDescription?: React.ReactNode;
}

const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, ...props }: ErrorStateProps) => {
const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'Something went wrong', errorDescription, defaulErrorDescription = null, ...props }: ErrorStateProps) => {
Copy link
Collaborator

@dlabaj dlabaj Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: You should be able to leave this as undefined and it will still give you the same result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #24

const classes = useStyles();
return (
<EmptyState variant={EmptyStateVariant.large} {...props}>
Expand All @@ -36,8 +38,7 @@ const ErrorState: React.FunctionComponent<ErrorStateProps> = ({ errorTitle = 'So
</Title>
<EmptyStateBody>
<Stack>
{errorDescription ? <StackItem>{errorDescription}</StackItem> : <><StackItem>There was a problem processing the request. Please try again.</StackItem>
<StackItem>If the problem persists, contact system support.</StackItem></>}
{errorDescription ? <StackItem>{errorDescription}</StackItem> : defaulErrorDescription}
</Stack>
</EmptyStateBody>
{document.referrer ? (
Expand Down