Skip to content

Commit

Permalink
feat(Erlang): Add constant for x-error-code header
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzploss-k committed Nov 16, 2023
1 parent 8ca57cb commit 860dbd4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erlang/kivra_api_errors.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
-export([
load/0,
load/1,
from_code/1, from_code/2, from_code/3
from_code/1, from_code/2, from_code/3,
header/0
]).

%%%_* Types ===================================================================
Expand Down Expand Up @@ -66,6 +67,9 @@ from_code(ErrorCode, LongMessage, Details) when is_map(Details) ->
Error
end.

-spec header() -> binary().
header() -> <<"x-error-code">>.

%%%_* Private -----------------------------------------------------------------
lookup(ErrorCode) ->
case persistent_term:get(key(ErrorCode), undefined) of
Expand Down

0 comments on commit 860dbd4

Please sign in to comment.