Skip to content

Improve error message if inadequate permissions

Keith Maxwell requested to merge github/fork/maxwell-k/patch-1 into master

So that a user with incorrect permissions or repository URL receives a helpful error message.

A badly configured repository can be difficult to debug. One example is if a user has the incorrect setting below, say if they miss the setup instructions 1. Errors other than HTTP 409s lead to stack traces.

git remote set-url origin https://gitlab.alpinelinux.org/alpine/aports.git

Before this change mkmr fails with a stack trace:

[?] Create Merge Request with the values shown above? (Y/n): y

Traceback (most recent call last):
  File "/usr/bin/mkmr", line 11, in <module>
    load_entry_point('mkmr==0.0.14', 'console_scripts', 'mkmr')()
  File "/usr/lib/python3.8/site-packages/mkmr/mkmr.py", line 363, in main
    print("id:", mr.attributes["iid"])
UnboundLocalError: local variable 'mr' referenced before assignment

After this change mkmr fails with an error message:

[?] Create Merge Request with the values shown above? (Y/n): y

Failed to create merge request see below for error message:
403 Forbidden

Merge request reports