Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebPushError not being raised correctly #457

Closed
rskwan opened this issue Mar 16, 2018 · 1 comment
Closed

WebPushError not being raised correctly #457

rskwan opened this issue Mar 16, 2018 · 1 comment

Comments

@rskwan
Copy link

rskwan commented Mar 16, 2018

When a WebPushException e is raised after trying to send a push using pywebpush, the error handling in push_notifications.webpush tries to read e.message, even though it may not exist. This doesn't break anything that isn't already broken, but does produce unnecessary errors.

Traceback (most recent call last):
  File ".../venv/lib/python3.5/site-packages/push_notifications/webpush.py", line 30, in webpush_send_message
    **kwargs)
  File ".../venv/lib/python3.5/site-packages/pywebpush/__init__.py", line 384, in webpush
    result, result.text))
pywebpush.WebPushException: Push failed: <Response [400]>: <HTML>
<HEAD>
<TITLE>UnauthorizedRegistration</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>UnauthorizedRegistration</H1>
<H2>Error 400</H2>
</BODY>
</HTML>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../notifications/models.py", line 75, in send
    results = device.send_message(json.dumps(payload))
  File ".../venv/lib/python3.5/site-packages/push_notifications/models.py", line 254, in send_message
    auth=self.auth, p256dh=self.p256dh, application_id=self.application_id, **kwargs)
  File ".../venv/lib/python3.5/site-packages/push_notifications/webpush.py", line 39, in webpush_send_message
    raise WebPushError(e.message)
AttributeError: 'WebPushException' object has no attribute 'message'
@rskwan rskwan changed the title WebPushException not being raised correctly WebPushError not being raised correctly Mar 16, 2018
@azmeuk
Copy link
Member

azmeuk commented Oct 29, 2023

Fixed by #674

@azmeuk azmeuk closed this as completed Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants