intel / iotivity-node

Node.js bindings for IoTivity
https://www.iotivity.org/
42 stars 44 forks source link

Error while running high level client. #100

Closed sanbeam closed 7 years ago

sanbeam commented 7 years ago

(node:3959) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Invalid ResourceInit (node:3959) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

gabrielschulhof commented 7 years ago

It sounds like you're not doing

(...).then( function() { /* ... success ... */ }, function() { /* ... error ... */ } );

but only

(...).then( function() { /* ... success ... */ } );

in response to a promise. If you only provide the first function, then the error goes unhandled, and will cause an exit with a fatal error in future node.js versions.

gabrielschulhof commented 7 years ago

In this case the error is occurring because the resource you wish to register does not pass validation.

sanbeam commented 7 years ago

Bingo! Problem solved.