In a simple search widget instance if content cannot be displayed, for example the user does not have the correct permissions, an error message should be displayed in the widget.
Sometimes it is not possible to display the content of a widget. There are many reasons for this possible failure and so the error message needs to be general enough to cover all cases. The error message will be displayed in the widget body using the Error "Message Banner" component https://ux.folio.org/storybook/?path=/story/messagebanner--basic-usage. The error message should be formed of two parts. The text to be displayed is "Content cannot be displayed". The second part is a link to "View error details". See the below mockup for an example.
The "View error details" UX pattern should mirror that of the Error Boundary component. See https://ux.folio.org/storybook/?path=/story/errorboundary--basic-usage.
- The modal header is "Error details".
- The first paragraph of text introduces the error with the text "The following occurred," and then a brief description of the result of the error. For example "The following occurred, preventing the display of content in the widget:"
- The error details are presented in full
- An option to "Copy" the error to the clipboard is presented
The mockup below shows an example of the "Error details" modal.
This will need to be a try/catch (.then/.catch on successful fetch promises, pattern same as here but with some state which triggers rendering of a messagebanner instead of the table) on the fetch for SimpleSearch (and later other WidgetType-fetches) specifically, likely here:
On catch should return an error component which should be generic and NOT tied to SimpleSearch itself. Potentially same component as