JsonRPC.ErrorResponse (JsonRPC v0.1.0) View Source

Representation of a JsonRPC error response. The JsonRPC version is always "2.0".

Examples

iex> JsonRPC.ErrorResponse.cast(id: 42, error: %{code: -32001, message: "invalid"})
{:ok,
  %JsonRPC.ErrorResponse{
    id: 42, jsonrpc: "2.0", error: %{code: -32001, message: "invalid"}
  }
}

Link to this section Summary

Functions

Converts the given data according to the defined schema.

Converts the given data according to the defined schema.

Returns true if the given data valid against the defined schema, otherwise false.

Validates the given data against the defined schema.

Validates the given data against the defined schema.

Link to this section Functions

Specs

cast(term()) ::
  {:ok, term()} | {:error, Xema.ValidationError.t() | Xema.CastError.t()}

Converts the given data according to the defined schema.

Returns an :ok tuple with the converted data for valid data, otherwise an :error tuple is returned.

Specs

cast!(term()) :: term()

Converts the given data according to the defined schema.

Returns converted data for valid data, otherwise a Xeam.CastError or Xema.ValidationError is raised.

Specs

valid?(term()) :: boolean()

Returns true if the given data valid against the defined schema, otherwise false.

Specs

validate(term()) :: :ok | {:error, Xema.ValidationError.t()}

Validates the given data against the defined schema.

Returns :ok for valid data, otherwise an :error tuple.

Specs

validate!(term()) :: :ok

Validates the given data against the defined schema.

Returns :ok for valid data, otherwise a Xema.ValidationError is raised.