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

Add details to exceptions raised in LobbyClient #898

Merged
merged 1 commit into from Jan 27, 2021
Merged

Add details to exceptions raised in LobbyClient #898

merged 1 commit into from Jan 27, 2021

Conversation

c-w
Copy link
Contributor

@c-w c-w commented Jan 27, 2021

This pull request customizes the error type used in LobbyClient to enable passing-through to callers additional details about the specific error that the client encountered. Amongst others, this behavior is useful in situations where the errors thrown by the Lobby API may contain remediation hints for the user. For example, when using custom setupData validation (see #831), the errors returned by the API may contain instructions to the user setting up a game on what exactly is incorrect about their configuration.

An alternative implementation could also expose the response object directly on LobbyClientError which would allow more flexibility to callers but also increase coupling with the client's implementation (e.g. changing away from fetch would be a breaking change).

Checklist

  • Use a separate branch in your local repo (not master).
  • Test coverage is 100% (or you have a story for why it's ok).

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c-w This looks great — thanks!

@delucis delucis merged commit ccc9ada into boardgameio:master Jan 27, 2021
1 check passed
@c-w c-w deleted the lobbyclient-errordetails branch January 27, 2021 20:17
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.

None yet

2 participants