Skip to content

Add details to exceptions raised in LobbyClient#898

Merged
delucis merged 1 commit into
boardgameio:masterfrom
c-w:lobbyclient-errordetails
Jan 27, 2021
Merged

Add details to exceptions raised in LobbyClient#898
delucis merged 1 commit into
boardgameio:masterfrom
c-w:lobbyclient-errordetails

Conversation

@c-w

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

Copy link
Copy Markdown
Contributor

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).

@delucis delucis left a comment

Copy link
Copy Markdown
Member

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
@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.

2 participants