Node-MPV icon indicating copy to clipboard operation
Node-MPV copied to clipboard

UnhandledPromiseRejection on seek

Open dave12311 opened this issue 3 years ago • 2 comments

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);
    }
})

dave12311 avatar May 28 '21 12:05 dave12311

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

j-holub avatar Jun 01 '21 18:06 j-holub

If it's okay I'm gonna do the PR request. It's been a year since the issue opened.

husudosu avatar Jul 04 '22 06:07 husudosu