From f65c5eb9e1d1197f455133213419738793b734a7 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 14 Jan 2019 19:07:30 +0100 Subject: [BROKEN] Adding {fetch,update_fetch,update,remove}_if OPs. --- src/ataxia_error.erl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ataxia_error.erl (limited to 'src/ataxia_error.erl') diff --git a/src/ataxia_error.erl b/src/ataxia_error.erl new file mode 100644 index 0000000..9d99944 --- /dev/null +++ b/src/ataxia_error.erl @@ -0,0 +1,36 @@ +-module(ataxia_error). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-type type() :: + ( + 'not_found' + | 'no_match' + | 'denied' + | 'locked' + | {'aborted', any()} + ). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export_type([type/0]). + +-export([to_string/1]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec to_string (type()) -> binary(). +to_string (not_found) -> <<"No entry with this ID.">>; +to_string (no_match) -> <<"No entry satisfy this condition.">>; +to_string (denied) -> <<"Access to entry denied.">>; +to_string (locked) -> <<"Entry is locked.">>; +to_string ({aborted, Error}) -> + list_to_binary(io_lib:format("Server-side error: ~p.", [Error])). -- cgit v1.2.3-70-g09d2