@@ -4,17 +4,19 @@ import ErrorState from '../ErrorState';
44import ErrorStack from '../ErrorStack' ;
55
66export interface ErrorPageProps {
7- /** Title to display on the error page */
7+ /** The title text to display on the error page */
88 headerTitle : string ;
9- /** Indicates if this is a silent error */
9+ /** Indicates if the error is silent */
1010 silent ?: boolean ;
11- /** Title given to the error */
11+ /** The title text to display with the error */
1212 errorTitle ?: string ;
13- /** A description of the error */
13+ /** The description text to display with the error */
1414 errorDescription ?: React . ReactNode ;
15- /** A default description of the error used if no errorDescription is provided. */
15+ /** The text for the toggle link that users can select to view error details */
16+ errorToggleText ?: string ;
17+ /** The default description text to display with the error if no errorDescription is provided */
1618 defaultErrorDescription ?: React . ReactNode ;
17- /** Children components */
19+ /** The component that the error boundary component is wrapped around, which should be returned if there is no error */
1820 children ?: React . ReactNode ;
1921}
2022
@@ -28,7 +30,7 @@ export interface ErrorPageState {
2830}
2931
3032// As of time of writing, React only supports error boundaries in class components
31- class ErrorBoundary extends React . Component < React . PropsWithChildren < ErrorPageProps > , ErrorPageState > {
33+ class ErrorBoundary extends React . Component < ErrorPageProps , ErrorPageState > {
3234 constructor ( props : Readonly < ErrorPageProps > ) {
3335 super ( props ) ;
3436 this . state = {
@@ -72,7 +74,7 @@ class ErrorBoundary extends React.Component<React.PropsWithChildren<ErrorPagePro
7274 < >
7375 < span > { this . props . errorDescription } </ span >
7476 { this . state . error && (
75- < ExpandableSection toggleText = "Show details" >
77+ < ExpandableSection toggleText = { this . props . errorToggleText ? this . props . errorToggleText : "Show details" } >
7678 < ErrorStack error = { this . state . error } />
7779 </ ExpandableSection >
7880 ) }
0 commit comments