feat(dev): use toast error messages for failed DevTool actions#146
Merged
feat(dev): use toast error messages for failed DevTool actions#146
Conversation
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 adds granular error handling to all developer tool form actions (closes #143). Previously, DevTool failures threw opaque
error()responses; now they usefail()with specific HTTP status codes (404, 422), enabling the client-side Svelte forms to display context-aware toast messages per failure type.Also fixes a cyclical type reference in
app.d.tsby importing from specific schema submodules instead of the barrel export.Implementation Notes
fail()overerror(): Dev tool actions now returnfail(status)orfail(status, message)instead of throwingerror(status). This letsuse:enhancecallbacks discriminate onresult.statusand show targeted toasts.roleaction catchesDrizzleQueryErrorwrappingDatabaseErrorwith code23503(foreign key violation) to surface a "Lab not found" toast when an invalid lab ID is provided.ValiErrorand returnfail(422)for malformed input, surfaced as "Invalid input" toasts on the client.AssertionErrorfromgetUserNameByEmail/getLabByIdand returnsfail(404, descriptiveMessage), allowing the client to show the specific missing entity in the toast.REPEATABLE READtransaction for atomicity of user upsert + session creation/swap.Test Cases