Skip to content

Commit

Permalink
Merge pull request #2244 from aeternity/PT-161642500-fix_error_message
Browse files Browse the repository at this point in the history
PT161642500: Fix decode-data error message
  • Loading branch information
hanssv committed Mar 19, 2019
2 parents b1a2ff0 + e9c648b commit 6f71173
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/aehttp/src/aehttp_logic.erl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ contract_call(ABI, EncodedCode, Function, Argument) ->
contract_decode_data(Type, Data) ->
case aeser_api_encoder:safe_decode(contract_bytearray, Data) of
{error, _} ->
{error, <<"Data must be hex encoded">>};
{error, <<"Data must be a contract bytearray (\"cb_...\")">>};
{ok, CallData} ->
try aect_sophia:decode_data(Type, CallData) of
{ok, _Result} = OK -> OK;
Expand Down
2 changes: 1 addition & 1 deletion apps/aehttp/test/aehttp_integration_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ broken_decode_sophia_data(_Config) ->
%% Field valid according to schema but invalid for handler.
{ok, 400, #{<<"reason">> := <<"bad_type">>}} =
get_contract_decode_data(#{'sophia-type' => <<"foo">>, data => D}),
{ok, 400, #{<<"reason">> := <<"Data must be hex encoded">>}} =
{ok, 400, #{<<"reason">> := <<"Data must be a contract bytearray (\"cb_...\")">>}} =
get_contract_decode_data(#{'sophia-type' => T, data => <<"foo">>}),
%% Field valid for both schema and handler, though data
%% interpreted in a different way than the specified type spec.
Expand Down

0 comments on commit 6f71173

Please sign in to comment.