Node-MPV
Node-MPV copied to clipboard
UnhandledPromiseRejection on seek
Bug Description
Calling the seek()
function while there is no file loaded causes uncaught UnhandledPromiseRejection exception.
How To Reproduce
Create an mpv instance and call seek without loading a file first.
Expected behavior
Calling an invalid seek should reject the promise returned by the seek()
function
Software Versions
- Node-Mpv: 2
- MPV: 0.33.1-dirty
- OS: Linux
Additional context
Quick fix with:
observeSocket.connect({path: this.options.socket}, async () => {
try {
await this.command('seek', [seconds, mode, 'exact']);
} catch (e) {
reject(e);
}
})
Hey there,
I'm sorry for only seeing this just now, Thanks for noticing, this is indeed something that shouldn't happen, as it's so simple. If you want to, you can make a PR or I can make the fix, up to you : )
Cheers
If it's okay I'm gonna do the PR request. It's been a year since the issue opened.