hoist-react icon indicating copy to clipboard operation
hoist-react copied to clipboard

`ErrorMessage` should provide better default behavior

Open saba-mo opened this issue 2 years ago • 2 comments

Several issues with the default behavior of errorMessage:

  1. 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) 
  1. 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.

saba-mo avatar Dec 16 '23 00:12 saba-mo

Anselm also pointed out related issues here in this ticket https://github.com/xh/hoist-react/issues/3441

Have closed in favor of this ticket

lbwexler avatar Jan 12 '24 11:01 lbwexler

See also #3693 - good sibling ticket to consider at the same time as any refactoring done here.

amcclain avatar Jun 25 '24 17:06 amcclain