RephiWeb.ErrorHelpers (Rephi v0.1.0)

View Source

Conveniences for formatting and returning error responses. Provides consistent error formatting across the application.

Summary

Functions

Returns a bad request error response.

Returns validation errors from a changeset.

Returns a standardized error response with a single error message.

Returns a standardized error response with multiple error messages.

Returns a not found error response.

Returns an unauthorized error response.

Translates changeset errors to a map.

Functions

render_bad_request(conn, message)

Returns a bad request error response.

render_changeset_errors(conn, changeset)

Returns validation errors from a changeset.

render_error(conn, status, message)

Returns a standardized error response with a single error message.

render_errors(conn, status, errors)

Returns a standardized error response with multiple error messages.

render_not_found(conn, message \\ "Not found")

Returns a not found error response.

render_unauthorized(conn, message \\ "Unauthorized")

Returns an unauthorized error response.

translate_errors(changeset)

Translates changeset errors to a map.