dropbox / pygerduty

A Python library for PagerDuty.
MIT License
163 stars 72 forks source link

Fix bug of argument order when raising IntegrationAPIError #50

Closed adnam closed 7 years ago

adnam commented 7 years ago

The Exception class IntegrationAPIError() is defined like this:

class IntegrationAPIError(Error):
    def __init__(self, message, event_type):
        self.event_type = event_type
        self.message = message

When raising it IntegrationAPIError() the method PagerDuty.create_event() the parameters were reversed:

if not response["status"] == "success":
    raise IntegrationAPIError(event_type, response["message"])

Should be:

if not response["status"] == "success":
    raise IntegrationAPIError(response["message"], event_type)

This PR simply reverses the order of the parameters when raising the exception.

CC/ @gmjosack

adnam commented 7 years ago

Looks like the build is broken, but seems to be unrelated to the changes in this PR.

gmjosack commented 7 years ago

Looks like tox might have gotten more strict. I'll work of fixing the build separately and let you know when I push a new version to PyPI.

Thanks for the fix!

adnam commented 7 years ago

Oh cool, wasn't sure if you'd see this :=) Glad to be of help.

gmjosack commented 7 years ago

Latest package should be available as pygerduty-0.35.2.

Thanks again!

adnam commented 7 years ago

:boom: