A community based topic aggregation platform built on atproto

fix(api): Add error logging to community XRPC handlers

Add logging for internal server errors in community XRPC handlers to
aid debugging during development. Internal errors are now logged before
returning generic error responses to clients.

Changes:
- Add log import to errors.go
- Log actual error details when returning InternalServerError
- Add TODO comment to migrate to proper structured logger

Rationale:
During E2E testing, internal errors were being silently swallowed making
debugging difficult. This change logs the actual error while still
returning safe generic error messages to clients.

Security note:
- Internal error details are NOT exposed to clients
- Logging is for server-side debugging only
- Generic "InternalServerError" message still returned to clients

TODO: Replace log.Printf with structured logger (e.g., zerolog/zap)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+4 -1
internal
api
handlers
community
+4 -1
internal/api/handlers/community/errors.go
···
import (
"encoding/json"
+
"log"
"net/http"
"Coves/internal/core/communities"
···
case err == communities.ErrMemberBanned:
writeError(w, http.StatusForbidden, "Blocked", "You are blocked from this community")
default:
-
// Internal server error
+
// Internal server error - log the actual error for debugging
+
// TODO: Use proper logger instead of log package
+
log.Printf("XRPC handler error: %v", err)
writeError(w, http.StatusInternalServerError, "InternalServerError", "An internal error occurred")
}
}