fix: Handle commit errors gracefully
This Merge Request improves the message that we provide to the user when a commit fails by handling several error types individually.
Screenshots
Error type | Message |
---|---|
User session expired | ![]() |
Push rule violation | ![]() |
Branch already exists | ![]() |
File has changed | ![]() |
Unauthorized to push to branch | ![]() |
How to reproduce
There are (of course) different reproduction steps for every error:
Session expired
- Uncomment the following snippet !151 (diffs)
- Change a file and commit as usual. That code snippet will delete the authorization token after three seconds which reproduces the session expired error.
Push rule violation
- Create a push rule in your test project in Project Settings -> Repository -> Push rules. For example: https://gdk.test:3443/gitlab-org/gitlab-shell/-/settings/repository#js-push-rules
- Create a commit that violates the push rule in the Web IDE.
Branch already exists
- Create a new branch with a name already taken by another branch.
File has changed
- Open the Web IDE in two tabs.
- Open the same branch in both tabs.
- Change a file in tab no. 1 and commit.
- Change the same file in tab no. 2 and commit.
Unauthorized to push to that branch
- Try committing to a branch that you can’t push to like main or
master.
Edited by Enrique Alcántara