j-holub / Node-MPV

A NodeJs Module for MPV Player
https://www.npmjs.com/package/node-mpv
MIT License
117 stars 73 forks source link

console.log() and unhandled rejections in console #62

Closed AxelTerizaki closed 4 years ago

AxelTerizaki commented 4 years ago

Hello there :)

I just triggered a "bug" and saw there was quite a few console.log()s left in the code.

For example if my app launches mpv, but it gets closed by the user (by mistake for example by pressing the q key) and I attempt to call nodempv.quit() from my app, I get an uncaught rejection and it gets printed in the console, but isn't caught in my logging.

Until recently my app was running from a terminal and thus everything was being printed there, so it wasn't that much a big deal, but we're trying to move the app to Electron, thus eliminating all console.log output as much as possible :)

On a side-note, you left a console.log('fooo') in lib/mpv/mpv.js and it drives my beta-testers crazy :)

EDIT: I'm using the node-mpv-2 branch.

j-holub commented 4 years ago

Haha, that sounds like me :D Thanks for letting me, I'll remove that one ASAP. I had my trouble as well with the uncaught promise rejections, I did a lot of changes recently (not sure if I commited or pushed those) that might help. But it's giving me a headache as well as I sometimes don't know enough about Promises it seems.

Currently also trying to move the Promise reject/resolve synthax to async/await

AxelTerizaki commented 4 years ago

If you'd like some help, we could look into the code together during a chat on Discord. I can't help with rewriting it for you but I can help if there are things you don't understand. You can add me with my handle AxelTerizaki#0001

j-holub commented 4 years ago

I think by now the unresolved promise error messages are resolved. Please feel free to reopen if you come across some of them again.