-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
new Core(params)
Throwing when Discord is not running (java-impl branch)
#76
Comments
The While I personally think that throwing an exception is the most useful thing to do in this case, the documentation is certainly lacking, and the behavior is unexpected. My idea to address this would be to deprecate The alternatives would be to silently fail if the flag is set and Discord is not running, or to follow the original behavior and fail with a What do you think? |
Maybe if I like the idea of a |
I also stumbled upon this exception when I developed the improved java channel setup (#61), but was not sure how to handle it. Therefore I just let the exception happen, if a pipe or socket cannot be found. The most common case, where this exception happens, is when the app the is started before Discord itself has been started. The biggest problem is, that an app, which uses discord-game-sdk4j won't try to reconnect to Discord after the channel setup failed once. So the app has to be restarted after Discord has been started in order to update the state etc. My idea is to enhance the However, I am not sure whether this is a good idea or not, because it won't prevent the exception in the setup phase and might even trigger more with each command. I think an option would be to just emit a warning if What do you think? Beside that: I don't really understand how |
I think the question ultimately comes down to how much the library wants to handle and how much the application should handle. Naturally, none of our features are going to work if Discord is not running. The In that sense
In my opinion, it would be best to introduce an I would also change the The behavior I propose would be the following:
|
I've tried to implement some kind of auto-reconnect functionality yesterday, but all my efforts were fruitless, because I was not able to resolve all channel related dependencies. For example some managers require an open channel and also some other components don't seem to like it when the channel is closed and then re-opened. In the end I came to the conclusion that the best way to handle a disconnect is to destroy the old core and create a new core once Discord is available again. Since this needs a way to determine whether Discord is running or not, I've created the pull request #80, which adds a |
So I started using Only thing left would be a way to ignore exceptions that are created when Discord doesn't exist and it would be perfect! |
That's cool! Then I'll look into a |
When Discord is not running
new Core(params)
thows aFileNotFoundException
.I use this:
params.setFlags(CreateParams.Flags.NO_REQUIRE_DISCORD);
So I wasn't really excepting this to happen, I expected a debug log saying that it could not find Discord so it was either not present or not running.
The text was updated successfully, but these errors were encountered: