hendrikw01 / tr-064

TR-064 - UPnP/IGD for node.js
Apache License 2.0
35 stars 24 forks source link

Disable default logging to console #16

Open skleeschulte opened 6 years ago

skleeschulte commented 6 years ago

Initializing tr064 with an invalid host:

tr064.initIGDDevice('invalid_host', 49000, (err, device) => { /* ... */ });

This will print to the console:

{ Error: getaddrinfo ENOTFOUND invalid_host invalid_host:49000
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
    code: 'ENOTFOUND',
        errno: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'invalid_host',
    host: 'invalid_host',
    port: '49000' }
undefined

I think the error should only be passed to the callback function so the user of this library can decide if and how to log/deal with this error.