velocityzen / node-upnp

Modern UPnP Client Library
MIT License
13 stars 7 forks source link

Errors on subscription renewal are not caught #16

Closed foxxyz closed 1 month ago

foxxyz commented 1 year ago

What Happens

If something goes wrong during the renewal of a subscription triggered by a setTimeout, the ensuing error will not be caught and crashes the program.

/path/to/node_modules/node-upnp/error.js:50
  const err = new Error('Subscription renewal error');
              ^

Error: Subscription renewal error
    at Object.SubscriptionRenewal (/path/to/node_modules/node-upnp/error.js:50:15)
    at UPnPClient.renewSubscription (/path/to/node_modules/node-upnp/index.js:272:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'SUBSCRIBE_RENEW',
  statusCode: 412
}

Node.js v18.9.1

What I Expected to Happen

I would expect it to keep retrying to renew the subscription in case of failure.

Curious on your thoughts?

foxxyz commented 1 year ago

@velocityzen is this intended behavior? It seems like this error should by caught in a try/catch within the setTimeout(...) block

Would you accept a PR for this?

foxxyz commented 3 months ago

@velocityzen are you still maintaining this repository?

velocityzen commented 1 month ago

@foxxyz sorry just noticed this. I do accept PRs!

velocityzen commented 1 month ago

@foxxyz thank you. released in 1.3.0

foxxyz commented 1 month ago

Thank you!