Handle transient local dev startup errors (fixes #155)#156
Open
diadal wants to merge 4 commits intocloudflare:mainfrom
Open
Handle transient local dev startup errors (fixes #155)#156diadal wants to merge 4 commits intocloudflare:mainfrom
diadal wants to merge 4 commits intocloudflare:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request enhances error handling during container startup in local development environments by introducing three new transient error types and updating error handling logic throughout the Container class. The changes aim to make the system more resilient by preventing crashes from temporary errors that occur while the container monitor is discovering instances and exposed ports.
Changes:
- Added three new error constants (
MONITOR_FAILED_TO_FIND_CONTAINER_ERROR,CONTAINER_PORT_NOT_FOUND_ERROR,CONNECTION_REFUSED_ERROR) and anisTransientContainerStartupErrorhelper function to identify recoverable startup errors - Updated error handling in
containerFetch,handleError, andsetupMonitorCallbacksto treat transient errors as non-fatal, returning early instead of crashing - Improved code quality by changing variable declarations from
lettoconstfor immutable values and alphabetically sorting type imports
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 pull request improves error handling and resilience during container startup and monitoring in the
Containerclass. The main focus is on identifying and gracefully handling transient errors that can occur during local development, preventing unnecessary crashes and improving the developer experience. Several error constants and utility functions have been added, and logic throughout the class has been updated to account for these transient errors.Error handling improvements:
MONITOR_FAILED_TO_FIND_CONTAINER_ERROR,CONTAINER_PORT_NOT_FOUND_ERROR,CONNECTION_REFUSED_ERROR) to identify transient container startup issues.isTransientContainerStartupErrorfunction to detect these transient errors and updated error handling logic infetch,handleError, and monitoring code to treat them as recoverable, avoiding crashes and improving resilience. [1] [2] [3] [4] [5]Code cleanup and refactoring:
lettoconstfor retry counters in container instance and port polling logic, improving clarity and immutability. [1] [2]constinstead ofletinrequestAndPortFromContainerFetchArgshandling.Type and import adjustments:
src/lib/container.ts.