Skip to content

Conversation

@zoejessica
Copy link

Three changes to increase the descriptiveness and accuracy of some HotwireNative errors:

  • conforms RedirectHandlerError to LocalizedError so we can pass on an exact description of the underlying error to the client
  • ensures that we use the precise status code passed from the server when a redirect failed, instead of always assuming a 0 status code.
  • fail with a contentTypeMismatch error (instead of status code 0) if the the url response is neither http nor a blob

@zoejessica zoejessica requested review from jayohms and svara September 8, 2025 14:07
@svara svara self-assigned this Sep 23, 2025
Copy link
Contributor

@svara svara left a comment

Choose a reason for hiding this comment

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

This is a good start. However, I'd like us to consolidate all the errors (maybe in a follow up PR?). Similar to what Android has.

I imagine an enum like:

enum HotwireNativeError: Error {
    case redirectionFailed(reason: RedirectFailureReason)
    ...
}

HotwireNativeError would encompass a few different types of errors, each with their own associated reasons.

@zoejessica
Copy link
Author

This is a good start. However, I'd like us to consolidate all the errors (maybe in a follow up PR?). Similar to what Android has.

Yes I agree, and I'll do it in this PR – this was really to get the ball rolling, starting off with the code we're already shipping in production. I'll refine! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants