aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rcl_util.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rcl_util.erl b/src/rcl_util.erl
index f6427ae..f89ba73 100644
--- a/src/rcl_util.erl
+++ b/src/rcl_util.erl
@@ -23,6 +23,8 @@
-export([mkdir_p/1,
to_binary/1,
+ is_error/1,
+ error_reason/1,
indent/1]).
-define(ONE_LEVEL_INDENT, " ").
@@ -55,6 +57,18 @@ to_binary(String) when erlang:is_list(String) ->
to_binary(Bin) when erlang:is_binary(Bin) ->
Bin.
+%% @doc get the reason for a particular relcool error
+-spec error_reason(relcool:error()) -> any().
+error_reason({error, {_, Reason}}) ->
+ Reason.
+%% @doc check to see if the value is a relcool error
+-spec is_error(relcool:error() | any()) -> boolean().
+is_error({error, _}) ->
+ true;
+is_error(_) ->
+ false.
+
+
%%%===================================================================
%%% Test Functions