Skip to content

refactor: Rework exception hierarchy for ServerpodClientException - #5560

Merged
Crazelu merged 23 commits into
serverpod:mainfrom
Crazelu:refactor/exception-hierarchy
Aug 19, 2026
Merged

Crazelu merged 23 commits into
serverpod:mainfrom
Crazelu:refactor/exception-hierarchy

Conversation

@Crazelu

@Crazelu Crazelu commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Reworks the exception hierarchy for ServerpodClientException and removes hacky way of dealing with network errors using -1 status code.

Part of #3283

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

  • The base ServerpodClientException no longer has a statusCode field.
  • ServerpodClientNetworkException is now thrown in place of ServerpodClientException with -1 statusCode.

@Crazelu
Crazelu marked this pull request as ready for review August 10, 2026 13:17
@Crazelu
Crazelu requested a review from a team August 10, 2026 13:22

@FXschwartz FXschwartz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

#3283 mentions all client exceptions deriving from a common base. Do we also need to handle MethodStreamException family and ServerpodClientGetEndpointException?

@marcelomendoncasoares marcelomendoncasoares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Few additional comments.

@Crazelu

Crazelu commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

#3283 mentions all client exceptions deriving from a common base. Do we also need to handle MethodStreamException family and ServerpodClientGetEndpointException?

It does seem valuable to do that.

@Crazelu

Crazelu commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

@FXschwartz
MethodStreamException and ServerpodClientGetEndpointException now derive from ServerpodClientException.
5b7e87f

@Crazelu
Crazelu requested a review from FXschwartz August 13, 2026 18:08

@FXschwartz FXschwartz left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All my comments have been addressed and pending @marcelomendoncasoares comments & CI failures being resolved it looks great to me.

@marcelomendoncasoares marcelomendoncasoares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Only one minor nit on the text of the throw on TimeoutException, but already leaving it approved!

@Crazelu
Crazelu merged commit f844fac into serverpod:main Aug 19, 2026
957 of 958 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants