Skip to content
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

Catch JDA exception when there is no internet connection #1304

Merged
merged 2 commits into from
Mar 6, 2023

Conversation

LachlanPond
Copy link
Contributor

This pull request...

  • Fixes a bug
  • Introduces a new feature
  • Improves an existing feature
  • Boosts code quality or performance

Description

Added catch clause to JMusicBot.java

Purpose

When running the bot without an internet connection, the JDA connection attempt will fail without catching the exception and doing a proper system exit. This means that if the bot cannot establish a connection, the program will wait instead of exiting. Automated restart scripts will not work as a result.

Relevant Issue(s)

This PR closes issue #1303

@Traydr
Copy link

Traydr commented Mar 1, 2023

Shouldn't the bot try to reconnect on error (with a delay)?

@jagrosh
Copy link
Owner

jagrosh commented Mar 2, 2023

Did you try building and testing this? It is failing to build with CI

@Traydr
Copy link

Traydr commented Mar 3, 2023

It's missing import net.dv8tion.jda.api.exceptions.ErrorResponseException for the ErrorResponseException. Not the author, but I noticed it yesterday.

@LachlanPond
Copy link
Contributor Author

It's missing import net.dv8tion.jda.api.exceptions.ErrorResponseException for the ErrorResponseException. Not the author, but I noticed it yesterday.

Yeah that's my mistake, I've added it in and tested on my machine. I have a systemd service that will now automatically restart on failure.

@jagrosh jagrosh merged commit 2c76164 into jagrosh:master Mar 6, 2023
ElerWohlmuthFH pushed a commit to ElerWohlmuthFH/MusicBot that referenced this pull request Sep 20, 2024
Catch JDA exception when there is no internet connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants