Skip to content

Add error handling to security training config

What does this MR do and why?

It adds error handling for both a GraphQL query and mutation on the security training configuration page.

Note: The related feature is currently behind a feature flag, so no changelog entry is needed.

Screenshots or screen recordings

query error mutation error
querry_error mutation_error

How to set up and validate locally

Setup

This feature is behind a feature flag, to enable:

echo "Feature.enable(:secure_vulnerability_training)" | rails c

Apply the following patch to simulate errors:

curl https://gitlab.com/gitlab-org/gitlab/-/snippets/2226423/raw/main/error_handling.patch | git apply

Testing steps

  1. Navigate to Security & Compliance > Configuration
  2. Click on the "Vulnerability Management" tab
  3. You should see the query error message
  4. Once the query error has confirmed edit app/assets/javascripts/security_configuration/resolver.js line 11 to not throw the error but return the commented data
  5. Reload the page and change one of the security provider's toggles
  6. Confirm mutation error message

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 #348711 (closed)

Edited by David Pisek

Merge request reports