Closed shabunin closed 4 years ago
Hey there,
sorry for the late reply, I got the Email Notification on my phone right away, read it and somehow forgot to reply.
I kinda have a feeling where the problem is coming from. My guess is, that the problem is, that your function has "mpv" in the name, but this shouldn't be a problem so this has to be fixed. I'll have a look.
Line 78 of mpv.js: const caller = stackMatch[stackMatch.length-1].split('.')[1].trim() + '()'
My function is "mpvLoad" and I believe that I will be not the only one who give such names. So, regex new Error().stack.match(/mpv.\w+\s/g);
creates array of two elements: [ 'mpv.load', 'mpvLoad' ]
. So, last one is mpvLoad
and can't be splitted by split('.')
So, I would reconsider error handling to avoid this issues in future.
Yeah that's exactly what I thought. I'll see how I can fix that
This should be fixed by c7075120235b5b379e10a691da51a903c87df61c if it's actually still relevant to you at all at this point.
First of all, thanks for this work.
Now, to the issue. I'm using v2 of this module and was trying to load url with
mpv.load
function and got unexpected behavior and error "Cannot read property trim of undefined". So, I took a look at source and there is check if that function was called viaload()
orappend()
for error handling purposes (here comes irony), done by regexp. So, I took a look atstackMatch
variable and mine was[ 'mpv.load ', 'mpvLoad ' ]
.mpvLoad
is function written by me and from it I callmpv.load(url);
So, it seems that
split('.')[1].trim()
is not the best way to check caller or may be you should change regexp(I'm not strong in it).