Module err

Source
Expand description

To generate HTTP error response.

use sylvia_iot_corelib::err::ErrResp;
// To generate HTTP request body format error.
if format_error(body) {
    return Err(ErrResp::ErrParam(Some("input format error".to_string())));
}

Enums§

ErrResp
The standard error definitions.

Constants§

E_AUTH
401, token not authorized.
E_DB
503, database error.
E_INT_MSG
503, internal service communication error.
E_NOT_FOUND
404, resource (in path) not found.
E_PARAM
400, request (body) format error.
E_PERM
403, invalid permission.
E_RSC
503, allocate resource error.
E_UNKNOWN
500, unknown error.

Functions§

to_json
To generate error JSON string for HTTP body.