Have you updated your firmware to 1v90? The promise returning undefined rather than an error sounds like a 1v88 issue.
undefined
If you're getting Uncaught Error: Unhandled promise rejection then you should be able to catch it with a .catch though.
Uncaught Error: Unhandled promise rejection
.catch
I guess it could be something strange with the promise implementation and your use of the second argument to then.
then
Have you tried just:
NRF.requestDevice({filters: [{namePrefix: 'Puck.js'}]}).then(dev=>{ console.log("device found", dev); return dev.gatt.connect(); }).then(conn=>{ console.log("connected", conn); return conn.getPrimaryService(0x464F); }).then(s=>{ console.log("service found", s); }).catch(e=>{ console.log( "error:", e ); });
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Have you updated your firmware to 1v90? The promise returning
undefined
rather than an error sounds like a 1v88 issue.If you're getting
Uncaught Error: Unhandled promise rejection
then you should be able to catch it with a.catch
though.I guess it could be something strange with the promise implementation and your use of the second argument to
then
.Have you tried just: