Skip to content

fix(auth): handle production login errors via Astro ActionError - #99

Merged
saifulalomdev merged 1 commit into
mainfrom
features
Jun 17, 2026
Merged

fix(auth): handle production login errors via Astro ActionError#99
saifulalomdev merged 1 commit into
mainfrom
features

Conversation

@saifulalomdev

Copy link
Copy Markdown
Owner

📝 Description

This PR addresses a critical production routing issue where failed authentication credentials threw generic JavaScript errors, disrupting client-side notification routing. It transitions the validation failure mechanism to a secure, explicit Astro error schema.

Key Changes:

  • Production Error Handling: Replaced the generic throw new Error() check with an explicit Astro ActionError object.
  • Security & Categorization: Configured the error state with the formal UNAUTHORIZED runtime code block to ensure predictable status headers and client-side handling under Cloudflare production edge deployments.

Fixes # (issue number)

🧪 Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor / Chore (codebase maintenance or optimization)

🛠️ How Has This Been Tested?

  • Verified credential rejection states locally within development runtime configurations.

  • Inspected execution logs to guarantee that client-side useAction catch blocks handle the descriptive string error message accurately without swallowing the response object.

  • Unit/Integration tests added/passed

  • Local manual edge verification successful

📸 Screenshots / Diffs (if applicable)

Modified File: src/modules/auth/auth.actions.ts

✅ Checklist

  • My code follows the brutalist/minimal style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new typescript compiler or linter errors

- Replace generic native Error with Astro's `ActionError` utility
- Set the error code explicitly to `UNAUTHORIZED` for production safety
- Improve error message clarity for incorrect credential submissions
@saifulalomdev
saifulalomdev merged commit 4c42ac0 into main Jun 17, 2026
1 check passed
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