Module jesse_error

Json schema validation module.

Description

Json schema validation module.

This module is the core of jesse, it implements the validation functionality according to the standard.

Data Types

error()

error() = {error, [error_reason()]}

error_reason()

error_reason() = {schema_invalid, Schema::jesse:json_term(), Error::error_type()} | {data_invalid, Schema::jesse:json_term(), Error::error_type(), Data::jesse:json_term(), Path::[binary()]} | {data_error, {parse_error, term()}} | {schema_error, {parse_error, term()}}

error_type()

error_type() = atom() | {atom(), jesse:json_term()} | {atom(), binary()}

Function Index

default_error_handler/3Implements the default error handler.
handle_data_invalid/3Generates a new data error and returns the updated state.
handle_schema_invalid/2Generates a new schema error and returns the updated state.
reason_to_jsx/1Convert an error reason to jsx structs.
to_json/1Convert an error to a JSON string using jsx.
to_json/2Convert an error to a JSON string using jsx.

Function Details

default_error_handler/3

default_error_handler(Error::error_reason(), ErrorList::[error_reason()], AllowedErrors::jesse:allowed_errors()) -> [error_reason()] | no_return()

Implements the default error handler. If the length of ErrorList exceeds AllowedErrors then the function throws an exeption, otherwise adds a new element to the list and returs it.

handle_data_invalid/3

handle_data_invalid(Info::error_type(), Value::jesse:json_term(), State::jesse_state:state()) -> jesse_state:state()

Generates a new data error and returns the updated state.

handle_schema_invalid/2

handle_schema_invalid(Info::schema_invalid | error_type(), State::jesse_state:state()) -> jesse_state:state()

Generates a new schema error and returns the updated state.

reason_to_jsx/1

reason_to_jsx(Reason::error_reason()) -> jesse:json_term()

Convert an error reason to jsx structs

to_json/1

to_json(Error::error()) -> binary()

Convert an error to a JSON string using jsx

to_json/2

to_json(Error::error(), JsxOptions::[atom()]) -> binary()

Convert an error to a JSON string using jsx


Generated by EDoc