-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix un-catched exception #120
Conversation
Hi! Can you tell me which deno version are you currently running? ( |
deno 1.46.3 |
Ok I see you mentioned deno 2+ is needed, my bad, I will revert the command line argument then |
music-rpc.ts
Outdated
if (this.rpc.ipc) { | ||
console.log("Closing connection to Discord RPC"); | ||
this.rpc.close(); | ||
this.rpc.ipc = undefined; | ||
console.log("Attempting to close connection to Discord RPC"); | ||
try { | ||
this.rpc.close(); | ||
} finally { | ||
console.log("Connection to Discord RPC closed"); | ||
this.rpc.ipc = undefined; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this block to something like this.tryCloseRPC()
to avoid having too many nested statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also put the if
statement in that method, let me know if you want it to take it out again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine, LGTM
Hi there!
Awesome project!
I have started to have an issue a few weeks ago where Apple Music will stop being responsive to pause and skip buttons. I am not sure if this is because of this library, so I looked into it.
I cannot consistently reproduce this issue, but the one time I could, I found an error in the logs at the same time:
Looking into the code, it seems
this.rpc.close();
is trusted to not error and any error coming from it is not catched. So in this PR I added atry
block around it. Even if this is not the root cause of my issue, it is still a good idea to catch any errors from this line of code.While running this code locally, I also noticed that it complains aboutso I followed the suggestion and used(I had an outdated deno version)--allow-hrtime
instead. If this is intended or my system is outdated feel free to let me know and I will revert this change.