Skip to content

Surface contact form submission errors instead of swallowing them - #6

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787084969-error-handling
Open

Surface contact form submission errors instead of swallowing them#6
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787084969-error-handling

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The only JS in the repo is the contact form handler in index.html. Both failure paths (non-2xx Formspree response and a thrown fetch) ended in a bare errorMsg.hidden = false with the caught error discarded, so a validation rejection, a rate limit, and an offline browser were indistinguishable — for the visitor and in the console.

Now the error is propagated to both audiences:

  • non-ok responses are parsed for Formspree's { errors: [{ message }] } / { error } payload, falling back to HTTP <status> <statusText>; JSON parse failure is itself logged rather than ignored
  • the detail is appended to the existing Estonian error text (… (detail)) and every failure is console.error-ed
  • missing #contactForm / #formSuccess / #formError now throw instead of failing with a TypeError on addEventListener, and the submit button is disabled for the duration of the request (re-enabled in finally) so a failed submit can't be double-fired.

Link to Devin session: https://app.devin.ai/sessions/74774155788442d78377a73aa25bec90
Requested by: @liikane

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@liikane liikane self-assigned this Aug 18, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant