Skip to content

Setting user language to something other than English affects API responses, including error messages #50

@rafauke

Description

@rafauke

Describe the bug
Using language other than English in Gitlab user preferences changes API requests. This breaks some functionalities since some errors are recognized by regexp patterns. Things like:

    # glcli.py:117
    except gitlab.GitlabHttpError as exception:

        if (
            exception.args[0]
            and "key" in exception.args[0]
            and "has already been taken" in str(exception.args[0]["key"])
        ):
            return set_project_var(scope, value, token, variable_name, update=True)

        logging.info(exception)                 
        error = f"Gitlab: {exception.args[0][4:]}"
        http_codes = {
            "403": f"Access denied to project {group}/{project}. Check your permissions.",
            "404": f"Project {group}/{project} does not exist.",
        }

Won't catch an exception like this:

400: {'key': ['(VAULT_TOKEN) zostało już zajęte']}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions