File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,25 @@ module.exports = function (RED) {
4141 }
4242 } )
4343 } ) . catch ( ( err ) => {
44+ // When a standard error text has been received, make sure it is converted to mimic a WebPushError object.
45+ // Otherwise it has no 'failed' property, so it will be considered no failure further on ...
46+ if ( err instanceof Error ) {
47+ err = {
48+ failed : {
49+ name : err . name ,
50+ message : "Standard exception" ,
51+ body : err . message
52+ }
53+ }
54+ }
55+
56+ // Remove some properties from the WebPushError to make sure the logs only contain useful information
57+ delete err . failed . headers
58+ delete err . failed . endpoint
59+
60+ // Log the error message to simplify troubleshooting
61+ node . error ( JSON . stringify ( err . failed ) )
62+
4463 resolve ( {
4564 failed : JSON . parse ( JSON . stringify ( err ) )
4665 } )
You can’t perform that action at this time.
0 commit comments