@impl Plug.ErrorHandler def handle_errors(conn, %{ kind: _kind, reason: %ArgumentError{ message: message }, stack: _stack }) do conn |> put_status(:bad_request) |> json(%{error: message}) end def handle_errors(conn, %{kind: _kind, reason: _reason, stack: _stack}) do json(conn, %{error: "Something went wrong"}) end
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter