writeInternalError logs the real error server-side and sends a generic message to the client. This prevents leaking SQL errors, file paths, and other internal details.
(w http.ResponseWriter, err error)
| 1820 | // message to the client. This prevents leaking SQL errors, file paths, |
| 1821 | // and other internal details. |
| 1822 | func writeInternalError(w http.ResponseWriter, err error) { |
| 1823 | slog.Error("internal server error", "error", err) |
| 1824 | writeError(w, http.StatusInternalServerError, "internal_error", "An internal error occurred") |
| 1825 | } |
| 1826 | |
| 1827 | // defaultJSONBodyLimit is the default cap applied to JSON request bodies |
| 1828 | // by decodeJSON. Every /api/* POST/PATCH is comfortably small in practice |
no test coverage detected