Skip to content

Commit

Permalink
Merge pull request #8 from alertlogic/explicit_fail
Browse files Browse the repository at this point in the history
handle explicit errors better
  • Loading branch information
Evgeny Bob authored Nov 16, 2018
2 parents 99179f6 + fa7f6af commit 0e1ab67
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/erllambda.erl
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@ format_reqid( ReqId, Format, Values ) ->
format( Format, Values ) ->
iolist_to_binary( io_lib:format( Format, Values ) ).

complete( #{success := Response} ) ->
% in success case we care only about the body
complete( #{success := Response}) ->
complete( result, Response );
complete( #{errorType := Response} ) ->
complete( failure, Response ).
% in error we care about the entire error object
complete( #{errorType := _} = Response) ->
complete( failure, Response).

complete( Type, Response ) ->
throw( {?MODULE, Type, Response} ).
Expand Down

0 comments on commit 0e1ab67

Please sign in to comment.