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

Improve the error message when the request fails #63

Closed
jgauffin opened this issue Dec 11, 2019 · 1 comment
Closed

Improve the error message when the request fails #63

jgauffin opened this issue Dec 11, 2019 · 1 comment

Comments

@jgauffin
Copy link

Can you add the response content to the exception message?
It will help immensely when getting started.

In HandleResponse:

// you might want to have a try/catch, there are cases when reading
// the content fails (although it should work in most cases)
var str = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
throw new WebPushException($"{message}. Details: {str}", response.StatusCode, response.Headers, subscription);

Before

WebPush.WebPushException: 'Received unexpected response code: 403'

After

WebPush.WebPushException: 'Received unexpected response code: 403. Details: the key in the authorization header does not correspond to the sender ID used to subscribe this user. Please ensure you are using the correct sender ID and server Key from the Firebase console.

coryjthompson added a commit that referenced this issue Feb 27, 2021
@coryjthompson
Copy link
Member

Thank you for the advice. This was released in version v1.0.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants