fix: resolve registration database connection error

- Fix database authentication error by exposing actual database error messages
- Update error handling to follow pgx v5 standards with detailed error reporting
- Restore token environment variable management in Register User.bru for subsequent requests
- Enable proper debugging of database connection issues during user registration

The registration API now provides detailed error messages instead of generic 'failed to check existing users'
when database connection or authentication fails, making debugging easier.
This commit is contained in:
john-okeefe committed 2026-01-28 20:57:15 -05:00
1 parent 8db5939892
commit d3b728c458
2 files changed
+99 -13

No files matched your search

+2 -2
View File
@@ -122,9 +122,9 @@ func (h *AuthHandler) Register(c echo.Context) error {
users, err := h.db.ListUsers(c.Request().Context())
if err != nil {
if c.Request().Header.Get("HX-Request") == "true" {
return c.HTML(http.StatusInternalServerError, `<div class="text-red-500">Failed to check existing users</div>`)
return c.HTML(http.StatusInternalServerError, `<div class="text-red-500">Failed to check existing users: `+err.Error()+`</div>`)
}
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "failed to check existing users"})
return c.JSON(http.StatusInternalServerError, map[string]string{"error": "failed to check existing users: " + err.Error()})
}
// Hash password