calcinator v5.0.0 Calcinator.Controller.Error View Source

Errors returned by Calcinator.Controller. Public, so that other controllers not using Calcinator.Controller can have same format for errors.

Link to this section Summary

Functions

Retort returned a 500 JSONAPI error inside a 422 JSONRPC error

The resource was deleted

The current resource or action is forbidden to the authenticated user

Puts 504 Gateway Timeout JSONAPI error in conn

Puts 404 Resource Not Found JSONAPI error in conn with parameter as the source parameter

Puts 500 Internal Server Error JSONAPI error in conn with title "Ownership Error"

Converts an {:error, _} tuple from Calcinator into a JSONAPI document and encodes it as the conn response

Puts JSONAPI Content Type in the Response of the conn

Converts an error reason from that isn’t a standard format (such as those from the backing store) to a 500 Internal Server Error JSONAPI error, but with id set to id that is also used in Logger.error, so that reason, which should remain private to limit implementation disclosures that could lead to security issues

Renders encodable as JSON after put_jsonapi_and_status on the conn

Puts 422 Unprocessable Entity JSONAPI error in conn with title "Sandbox Access Disallowed"

Puts 422 Unrpcessable Entity JSONAPI error in conn with title "Child missing"

Link to this section Functions

Retort returned a 500 JSONAPI error inside a 422 JSONRPC error.

The resource was deleted

The current resource or action is forbidden to the authenticated user

Link to this function gateway_timeout(conn) View Source
gateway_timeout(Plug.Conn.t) :: Plug.Conn.t

Puts 504 Gateway Timeout JSONAPI error in conn.

Link to this function not_found(conn, parameter) View Source

Puts 404 Resource Not Found JSONAPI error in conn with parameter as the source parameter.

Link to this function ownership_error(conn) View Source
ownership_error(Plug.Conn.t) :: Plug.Conn.t

Puts 500 Internal Server Error JSONAPI error in conn with title "Ownership Error".

Link to this function put_calcinator_error(conn, arg) View Source

Converts an {:error, _} tuple from Calcinator into a JSONAPI document and encodes it as the conn response.

Link to this function put_resp_content_type(conn) View Source

Puts JSONAPI Content Type in the Response of the conn

Link to this function render_changeset_error(conn, changeset) View Source
render_changeset_error(Plug.Conn.t, Ecto.Changeset.t) :: Plug.Conn.t

Renders changeset as an error object using the Alembic.Document.from_ecto_changeset/1.

Link to this function render_error_reason(conn, reason) View Source
render_error_reason(Plug.Conn.t, reason :: term) :: Plug.Conn.t

Converts an error reason from that isn’t a standard format (such as those from the backing store) to a 500 Internal Server Error JSONAPI error, but with id set to id that is also used in Logger.error, so that reason, which should remain private to limit implementation disclosures that could lead to security issues.

Log Messages

id=UUIDv4 reason=inspect(reason)

Returns

Link to this function render_json(conn, encodable, status) View Source
render_json(Plug.Conn.t, term, atom) :: Plug.Conn.t

Renders encodable as JSON after put_jsonapi_and_status on the conn.

Link to this function sandbox_access_disallowed(conn) View Source
sandbox_access_disallowed(Plug.Conn.t) :: Plug.Conn.t

Puts 422 Unprocessable Entity JSONAPI error in conn with title "Sandbox Access Disallowed".

Link to this function sandbox_token_missing(conn) View Source
sandbox_token_missing(Plug.Conn.t) :: Plug.Conn.t

Puts 422 Unrpcessable Entity JSONAPI error in conn with title "Child missing".