Skip to content

Improve WebIDE error messages on committing

Himanshu Kapoor requested to merge 249819-ide-improve-errors into master

What does this MR do?

Improve WebIDE error messages on committing

There was already some work done to improve error message handling in !42383 (merged). A proposal to improve the messaging for CODEOWNERS rule violation, branch changed and unexpected errors was made in #212595 (closed).

This MR improves the error messaging even further:

  • Adds handling for "Branch already exists" error. To test this error, just enter "master" in the new branch input box before committing.
  • Clicking "Create new branch" in the modal now should add or update a numeric suffix to the branch name. If you entered "master" earlier, it should now change to "master-1". If it was root-patch-22442, it would change to root-patch-22443.

    Without this change, the user would be stuck in a dialog box loop if the branch already existed, each time they clicked on "Create new branch". (You can test out this on GitLab.com)
  • When an unexpected error occurs, the message sent from backend is displayed to the user instead of the default message "Could not commit. An unexpected error occured."

Screenshots

Scenario Screenshot
"Branch already exists" error occured image
After clicking "Create new branch" in the dialog above.

Note that the name of branch becomes master-2 because both master and master-1 already exist in this particular example.
image__3_
Unexpected error scenario: user does not have permission to commit to master, but they manually enter master in the create branch input box. image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Himanshu Kapoor

Merge request reports