Skip to content

atlassian.bitbucket.cloud.base.BitbucketCloudBase:raise_for_status() bug #1481

Closed
@bachew

Description

@bachew

There's problem in atlassian.bitbucket.cloud.base.BitbucketCloudBase:raise_for_status() where it fails while constructing error message, causing real error to be hidden. This is the error I got:

Traceback (most recent call last):
  File "/home/chewbo/jenkins/jenkins-repos/venv/lib/python3.9/site-packages/atlassian/bitbucket/cloud/base.py", line 116, in raise_for_status
    error_msg += "\n" + e["detail"]
TypeError: can only concatenate str (not "dict") to str

My solution was simple, just use string interpolation:

# error_msg += "\n" + e["detail"]  # from this
error_msg = f"{error_msg}\n{e['detail']}"  # to this

After that I finally got the real error:

requests.exceptions.HTTPError: Your credentials lack one or more required privilege scopes.
{'required': ['pullrequest'], 'granted': ['webhook', 'repository:admin', 'repository:write', 'project', 'team']}

This can be reproduce by trying to create webhook with pullrequest:fulfilled event but without pullrequest access.

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