Skip to content
Permalink
Browse files
Expose error string description function in the API
  • Loading branch information
nickva committed Nov 25, 2019
1 parent f310eaa commit be840942bcb60b2843e6c846488436df75f2a560
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
@@ -113,7 +113,8 @@
% Misc
on_error/2,
error_predicate/2,
get_last_error/0
get_last_error/0,
get_error_string/1
]).


@@ -614,6 +615,10 @@ get_last_error() ->
erlang:get(?ERLFDB_ERROR).


get_error_string(ErrorCode) when is_integer(ErrorCode) ->
erlfdb_nif:get_error(ErrorCode).


clear_erlfdb_error() ->
put(?ERLFDB_ERROR, undefined).

@@ -16,4 +16,11 @@


load_test() ->
erlfdb_nif:ohai().
erlfdb_nif:ohai().


get_error_string_test() ->
?assertEqual(<<"Success">>, erlfdb_nif:get_error(0)),
?assertEqual(<<"Transaction exceeds byte limit">>,
erlfdb_nif:get_error(2101)),
?assertEqual(<<"UNKNOWN_ERROR">>, erlfdb_nif:get_error(9999)).

0 comments on commit be84094

Please sign in to comment.