hoist-react
hoist-react copied to clipboard
`ErrorMessage` should provide better default behavior
Several issues with the default behavior of errorMessage:
- The component offers the actionFn and detailsFn props that, when provided, will render styled Retry and Details buttons. It would be an improvement if you could set a prop to true that would not only get you the styled button but also a default function for the button's onClick. Right now you have to write the following boilerplate to get commonly used functions.
actionFn: () => model.refreshAsync()
detailsFn: () => XH.exceptionHandler.showExceptionDetails(error)
- The most obvious binding choice --
errorMessage({error: model.lastLoadException})
often doesn't look good:
e.g. Model throws in doLoadAsync() with e.g. HTTP500, resulting error comes back from fetchService with empty string message, mildly-useful name. Our errorMessage component displays small empty red box - looks silly.
Should be able to better source meaningful content from exception + fallback to generic error message string if none found.