feat: Expose more detail in dev server errors [FUN-701]#522
Merged
Conversation
This way we know what wasn't found.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances dev server error responses by exposing detailed error messages and refactoring error handling throughout the codebase. Key updates include:
- Switching from errors.Is to errors.As for more expressive error type handling.
- Updating error messages to reflect actual error details and replacing legacy error variables with newly defined error types.
- Adjusting tests to assert errors via errors.As instead of errors.Is.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/dev_server/sdk/store_facade.go | Updated WriteError to use errors.As and print the error’s own message. |
| internal/dev_server/model/sync_test.go | Changed test assertions from ErrorIs to ErrorAs for project insertion. |
| internal/dev_server/model/sync.go | Refactored error check for project creation to use errors.As. |
| internal/dev_server/model/store.go | Removed legacy error variable definitions for NotFound and AlreadyExists. |
| internal/dev_server/model/override_test.go | Adjusted tests to assert ErrNotFound errors using errors.As. |
| internal/dev_server/model/override.go | Modified to return NewErrNotFound with detailed error information. |
| internal/dev_server/model/error.go | Removed legacy custom error implementation. |
| internal/dev_server/model/err_not_found.go | Added new error type for not found errors with detailed message formatting. |
| internal/dev_server/model/err_already_exists.go | Added new error type for already exists errors (error message needs update). |
| internal/dev_server/db/sqlite_test.go | Updated tests to verify errors using errors.As. |
| internal/dev_server/db/sqlite.go | Updated error returns to use NewErrNotFound and NewErrAlreadyExists. |
| internal/dev_server/api/put_override_flag.go | Adjusted error check to use errors.As for identifying ErrNotFound. |
| internal/dev_server/api/post_add_project.go | Refactored error handling to use errors.As and return err.Error() message. |
| internal/dev_server/api/delete_flag_override.go | Changed error handling to use errors.As for ErrNotFound errors. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
tvarney13
approved these changes
Apr 15, 2025
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.
Expose more details about dev server errors like what thing wasn't found. Requested in #520.
Related Jira issue: FUN-701: Merge customer PR (error fidelity)