Repository navigation
fix(web): return addPromptToSet failures as values instead of throwing - #580
Merged
Merged
Conversation
Production masks errors thrown from server actions, so plan-limit and validation failures from addPromptToSet reached users as the meaningless digest toast (#427 pattern). Convert it to the same { prompt } | { error, code? } shape savePromptSet adopted in #536: - addPromptToSet returns { prompt } | { error, code?: 'plan_limit' }; PlanLimitError from enforceLimit maps to code 'plan_limit' - addPromptToBrand and trackFanoutQuery drop their try/catch wrappers and forward the error value - acceptSuggestion keeps its existing throwing contract, adapted to the new shape - brand Prompts page (bulk suggestion save + manual add) shows the real message via toast; the bulk path also refreshes the list on partial failure so saved prompts appear Closes #547
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.
Summary
addPromptToSetstill threw on user-reachable failures, so in production the plan-limit and validation messages surfaced as the maskedAn error occurred in the Server Components render… digesttoast. This converts it to the same value-shapesavePromptSetadopted in #536:addPromptToSetnow returns{ prompt } | { error, code?: 'plan_limit' }; all four throw sites became values ("Prompt set not found",PlanLimitError→code: 'plan_limit', empty platform/model selection, Supabase insert errors).addPromptToBrandandtrackFanoutQuerydrop their try/catch wrappers and forward the error value;acceptSuggestionkeeps its existing throwing contract, adapted to the new shape.Related issue
Closes #547
Type of change
fix— Bug fixHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)