Skip to content

Report Widgets Core: Add support for fetch failures

What does this MR do and why?

This MR updates the base of the report widgets core extensions to be able to handle fetch errors. It does this by changing the initial value to an empty object (fixing the immediate length syntax errors) and then updating the widgets header text to indicate it failed to load.

Extensions can use the $options.i18n.error text to customise what the error says and define a new fetchErrorHandler() method to do any further handling (e.g. Sentry) that the widget might need.

Screenshots or screen recordings

Screen_Recording_2021-11-19_at_11.48.44

How to set up and validate locally

  1. Enable the feature flag: echo "Feature.enable(:refactor_mr_widgets_extensions)" | rails c
  2. For simplicity, you can test this with status checks:
    1. Enable the feature flag: echo "Feature.enable(:external_status_checks)" | rails c
    2. Cherry-pick the changes from: !74200 (merged)
    3. Add a status check to the project: https://docs.gitlab.com/ee/user/project/merge_requests/status_checks.html
    4. View an MR in your project
  3. Check the status checks widget is rendered and shows your status check
  4. Reload the page and either disable your network connection or use your browsers in-built blocker: Chrome or Firefox
  5. Check that there are no new unhandled errors and the status check widget notes the failure

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #345496 (closed)

Edited by Robert Hunt

Merge request reports

Loading