Tue 2021.09.07
It appears that the error may be caused and thrown from within the disconnect() function at L15
http://www.espruino.com/Reference#t_l_BluetoothRemoteGATTServer_disconnect function BluetoothRemoteGATTServer.disconnect() Returns: A Promise that is resolved (or rejected) when the disconnection is complete (non-standard) See Note: 'In Espruino we return a Promise to make it easier to detect when Espruino is free to connect to something else.'
http://www.espruino.com/Reference#t_l_BluetoothRemoteGATTServer_disconnect
function BluetoothRemoteGATTServer.disconnect() Returns: A Promise that is resolved (or rejected) when the disconnection is complete (non-standard)
See Note: 'In Espruino we return a Promise to make it easier to detect when Espruino is free to connect to something else.'
That said, I thought it would be a breeze to add detection code, but code location and the syntax is a bit different with nested functions.
Maybe this might provide some clues:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
@Robin 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.
Tue 2021.09.07
It appears that the error may be caused and thrown from within the disconnect() function at L15
That said, I thought it would be a breeze to add detection code, but code location and the syntax is a bit different with nested functions.
Maybe this might provide some clues: