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

Fix some problematic uses of Possible::get #749

Merged
merged 2 commits into from Jul 28, 2020
Merged

Conversation

darichey
Copy link
Member

Description:
Replace many uses of Possible::get with explicit orElseThrow. These were mostly in places in core entities where it wasn't clear previously if the fields actually had the potential to be absent. I have included comments to explain where the equivalent get() would have been safe.

In the case of Embed, many of the uses of get() were not safe and resulted in errors. For now, they have been updated to return null instead. A following PR targeted to 3.2 will make them Optional.

Justification:
Fixes #747

@darichey darichey added the area/core Related to core module: events, entities, clients, specs label Jul 27, 2020
@darichey darichey linked an issue Jul 27, 2020 that may be closed by this pull request
@darichey darichey added the bug A general bug label Jul 27, 2020
@darichey darichey added this to In progress in Discord4J v3.0 - v3.1 via automation Jul 27, 2020
@darichey darichey added this to the 3.1.1 milestone Jul 27, 2020
Discord4J v3.0 - v3.1 automation moved this from In progress to Approved Jul 28, 2020
@darichey darichey merged commit b48b5c7 into 3.1.x Jul 28, 2020
Discord4J v3.0 - v3.1 automation moved this from Approved to Done Jul 28, 2020
@darichey darichey deleted the fix/possible-gets branch July 28, 2020 05:28
@quanticc quanticc mentioned this pull request Jul 29, 2020
24 tasks
darichey added a commit that referenced this pull request Jul 29, 2020
Use Optional instead of @nullable when appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Related to core module: events, entities, clients, specs bug A general bug
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Embed fields such as author icon are considered non-optional
3 participants