PT-168026292 structured error messages #631
@ -2297,6 +2297,10 @@ mk_error({map_in_map_key, KeyType}) ->
|
||||
Msg = io_lib:format("Invalid key type\n~s\n", [pp_type(" ", KeyType)]),
|
||||
Cxt = "Map keys cannot contain other maps.\n",
|
||||
mk_t_err(pos(KeyType), Msg, Cxt);
|
||||
mk_error({cannot_call_init_function, Ann}) ->
|
||||
Msg = "The 'init' function is called exclusively by the create contract transaction\n"
|
||||
"and cannot be called from the contract code.\n",
|
||||
mk_t_err(pos(Ann), Msg);
|
||||
mk_error(Err) ->
|
||||
Msg = io_lib:format("Unknown error: ~p\n", [Err]),
|
||||
mk_t_err(pos(0, 0), Msg).
|
||||
|
@ -477,6 +477,10 @@ failing_contracts() ->
|
||||
"Invalid key type\n"
|
||||
" lm\n"
|
||||
"Map keys cannot contain other maps.">>]}
|
||||
, {"calling_init_function",
|
||||
[<<?Pos(7, 28)
|
||||
"The 'init' function is called exclusively by the create contract transaction\n"
|
||||
"and cannot be called from the contract code.">>]}
|
||||
].
|
||||
|
||||
-define(Path(File), "code_errors/" ??File).
|
||||
|
7
test/contracts/calling_init_function.aes
Normal file
7
test/contracts/calling_init_function.aes
Normal file
@ -0,0 +1,7 @@
|
||||
contract CallingInitFunction =
|
||||
|
||||
type state = int * int
|
||||
|
||||
entrypoint init() = (1, 2)
|
||||
|
||||
entrypoint call_init() = init()
|
Loading…
x
Reference in New Issue
Block a user