Replace TurboError with structured error types and improve cold boot retry#231
Open
Replace TurboError with structured error types and improve cold boot retry#231
Conversation
Introduce HTTPError, WebError, LoadError, and HotwireNativeError to provide richer, more descriptive error information throughout the framework. These typed errors enable pattern matching and give consumers actionable context about failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Pass statusCode from Turbo.js for non-HTTP status failures - Add turboIsReady message to detect missing Turbo library earlier - Add statusCode property to ScriptMessage - Improve RedirectHandler with timeout, typed errors, and remove unnecessary status code validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all Error/TurboError usage with HotwireNativeError across the core layers. Add retry-before-fail logic for transient JS fetch failures and only offer retry handlers for retryable errors. Remove the now-unused TurboError type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use pattern matching on HotwireNativeError in SceneController - Add turboIsReady ScriptMessage tests - Update SessionTests for dual notReady/notPresent load errors - Adopt HotwireNativeError in test helpers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closed
alpkeser
reviewed
Feb 13, 2026
| case .pageLoaded: | ||
| pageLoadDelegate?.webView(self, didLoadPageWithRestorationIdentifier: message.restorationIdentifier!) | ||
| case .turboIsReady: | ||
| let isReady = message.data["isReady"] as? Bool ?? false |
There was a problem hiding this comment.
Nitpick: Like others, we could define a property for this on ScriptMessage.
zoejessica
reviewed
Feb 13, 2026
Comment on lines
+37
to
+38
| var request = URLRequest(url: location) | ||
| request.timeoutInterval = 30 |
There was a problem hiding this comment.
As discussed with @olivaresf , if this lands in a HN release we'll need to a) investigate if we can make the turbo timeout and url request timeouts concurrent rather than seemingly additive and b) probably make this a config value for clients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the generic
TurboErrorenum with a structuredHotwireNativeErrortype hierarchy that provides better error categorization, richer context, and smarter recovery behavior.New Error Types
RedirectHandler changes
error.isRetryablein Navigator.Update JS Bridge
===
Cold-boot retry (handled by hotwire-native)
When a Turbo.js visit fails with a non-HTTP status (error 0, timeout, etc.), the library now:
RedirectHandlerto check server reachability