Skip to content

fix(detectors): Surface API error messages for cron detector creation#112630

Merged
malwilley merged 1 commit intomasterfrom
malwilley/detector-error-msg
Apr 10, 2026
Merged

fix(detectors): Surface API error messages for cron detector creation#112630
malwilley merged 1 commit intomasterfrom
malwilley/detector-error-msg

Conversation

@malwilley
Copy link
Copy Markdown
Member

Closes ISWF-2304

When creating a cron monitor with a slug that's already in use, the API returns a 400 with a useful error message nested inside dataSources.slug. But the frontend was just showing a generic "Unable to create monitor" toast, which isn't helpful.

This PR adds proper error surfacing in two ways:

  1. For all monitor forms, extract the error message from the API response and show it in a toast
  2. Specifically for the cron error, uses mapFormErrors to map the dataSources.slug error to the name field

For both of those points, I think that there are better ways we can handle these errors by supporting them in the base form components or by adding a better abstraction to our specific form to deal with the data source mapping. But until we refactor to the use the new form components, I think this is sufficient for now.

CleanShot 2026-04-09 at 13 30 02@2x CleanShot 2026-04-09 at 13 31 17@2x

@malwilley malwilley requested a review from a team as a code owner April 9, 2026 21:56
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 9, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 9, 2026
Copy link
Copy Markdown
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - thanks for including some todos around this too.

for the future - should we also try to standardize the API response (at least within workflow engine)? i think that might also help simplify the findFirstMessage function.

@malwilley
Copy link
Copy Markdown
Member Author

for the future - should we also try to standardize the API response (at least within workflow engine)? i think that might also help simplify the findFirstMessage function.

Yes it certainly could! Maybe we don't need to return a keyed object at all, it could just be an array of error messages

@malwilley malwilley merged commit 33054d2 into master Apr 10, 2026
66 checks passed
@malwilley malwilley deleted the malwilley/detector-error-msg branch April 10, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants