Skip to content

Commit 8dcf1b9

Browse files
authored
Merge pull request #257 from kapoorji/master
Add endpoint property in WebPushError #250
2 parents 28592a2 + 5559ce1 commit 8dcf1b9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/web-push-error.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'use strict';
22

3-
function WebPushError(message, statusCode, headers, body) {
3+
function WebPushError(message, statusCode, headers, body, endpoint) {
44
Error.captureStackTrace(this, this.constructor);
55

66
this.name = this.constructor.name;
77
this.message = message;
88
this.statusCode = statusCode;
99
this.headers = headers;
1010
this.body = body;
11+
this.endpoint = endpoint;
1112
}
1213

1314
require('util').inherits(WebPushError, Error);

src/web-push-lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ WebPushLib.prototype.sendNotification =
272272
pushResponse.on('end', function() {
273273
if (pushResponse.statusCode !== 201) {
274274
reject(new WebPushError('Received unexpected response code',
275-
pushResponse.statusCode, pushResponse.headers, responseText));
275+
pushResponse.statusCode, pushResponse.headers, responseText, subscription.endpoint));
276276
} else {
277277
resolve({
278278
statusCode: pushResponse.statusCode,

0 commit comments

Comments
 (0)