espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.73k stars 741 forks source link

getPressure: handle error when we don't have an exception #2438

Closed bobrippling closed 6 months ago

bobrippling commented 7 months ago

This handles an I2C error, originally ocurring in #2137, found again by chance in an unrelated PR.

When we create a promise for getPressure, we now look at both jspGetException and then jspHasError (separately). If the former is null but we have an error, we raise an exception about the I2C communication with the barometer.

Previous behaviour would raise an exception with no payload, leading to the Uncaught Error: Unhandled promise rejection: undefined seen in the BangleApps pull request above.

gfwilliams commented 7 months ago

Looks like there's a build error here as well? https://github.com/espruino/Espruino/actions/runs/7112131428/job/19361472245?pr=2438

edit: ahh - you made a comment about this above

bobrippling commented 6 months ago

This is ready for another look btw :)

gfwilliams commented 6 months ago

Thanks - just looked again and this looks good! Merging now!