You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When certain functions (I encountered the error with mpv.getProperty but I assume it also occurs with other async functions) are called before mpv.start(), node crashes instead of throwing an error or something
How To Reproduce
Steps to reproduce the behavior: just call mpv.getProperty("filename") without mpv.start() first
Expected behavior
Some error is printed to the console without crashing the program
Software Versions
Node-Mpv: 2.0.0-beta.2
MPV: mpv 0.37.0
OS: Linux Debian (Kubuntu)
Additional context
The Socket class in the node:net module provides event listeners which can be used to handle these errors. For example, for the send function:
send: function(command){returnnewPromise((resolve,reject)=>{
...
// create an ipcRequest object to store the required information for error messages// put the resolve function in the ipcRequests dictionary to call it laterthis.ipcRequests[request_id]=newipcRequest(resolve,reject,Object.values(command).splice(1));// BEGIN: patch// Listen for the "error" eventconsthandleError=(err)=>{this.socket.removeListener('error',handleError);returnreject('An error occurred:',err.message)}// TODO: improve error messagethis.socket.on('error',handleError);// END: patchtry{this.socket.write(JSON.stringify(messageJson)+'\n');}// reject the promise in case of an errorcatch(error){returnreject(this.errorHandler.errorMessage(7,message,'send()',JSON.stringify(command)));}})}
The text was updated successfully, but these errors were encountered:
Bug Description
When certain functions (I encountered the error with
mpv.getProperty
but I assume it also occurs with other async functions) are called beforempv.start()
, node crashes instead of throwing an error or somethingHow To Reproduce
Steps to reproduce the behavior: just call
mpv.getProperty("filename")
withoutmpv.start()
firstExpected behavior
Some error is printed to the console without crashing the program
Software Versions
Additional context
The Socket class in the node:net module provides event listeners which can be used to handle these errors. For example, for the
send
function:The text was updated successfully, but these errors were encountered: