File not found error
This commit is contained in:
parent
ecfa04ba17
commit
37a37a169d
@ -75,8 +75,9 @@ file(File, Options0) ->
|
|||||||
case read_contract(File) of
|
case read_contract(File) of
|
||||||
{ok, Bin} -> from_string(Bin, [{src_file, File} | Options]);
|
{ok, Bin} -> from_string(Bin, [{src_file, File} | Options]);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
ErrorString = [File,": ",file:format_error(Error)],
|
Msg = lists:flatten([File,": ",file:format_error(Error)]),
|
||||||
{error, join_errors("File errors", [ErrorString], fun(E) -> E end)}
|
Pos = aeso_errors:pos(File, 0, 0),
|
||||||
|
{error, [aeso_errors:new(file_error, Pos, Msg)]}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
add_include_path(File, Options) ->
|
add_include_path(File, Options) ->
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
}).
|
}).
|
||||||
|
|
||||||
-type pos() :: #pos{}.
|
-type pos() :: #pos{}.
|
||||||
-type error_type() :: type_error | parse_error | code_error | internal_error.
|
-type error_type() :: type_error | parse_error | code_error | file_error | internal_error.
|
||||||
|
|
||||||
-record(err, { pos = #pos{} :: pos()
|
-record(err, { pos = #pos{} :: pos()
|
||||||
, type :: error_type()
|
, type :: error_type()
|
||||||
|
@ -32,6 +32,13 @@ simple_compile_test_() ->
|
|||||||
end
|
end
|
||||||
end} || ContractName <- compilable_contracts(), Backend <- [aevm, fate],
|
end} || ContractName <- compilable_contracts(), Backend <- [aevm, fate],
|
||||||
not lists:member(ContractName, not_yet_compilable(Backend))] ++
|
not lists:member(ContractName, not_yet_compilable(Backend))] ++
|
||||||
|
[ {"Test file not found error",
|
||||||
|
fun() ->
|
||||||
|
{error, Errors} = aeso_compiler:file("does_not_exist.aes"),
|
||||||
|
ExpErr = <<"In 'does_not_exist.aes' at line 0, col 0:\n"
|
||||||
|
"does_not_exist.aes: no such file or directory">>,
|
||||||
|
check_errors([ExpErr], Errors)
|
||||||
|
end} ] ++
|
||||||
[ {"Testing error messages of " ++ ContractName,
|
[ {"Testing error messages of " ++ ContractName,
|
||||||
fun() ->
|
fun() ->
|
||||||
Errors = compile(aevm, ContractName),
|
Errors = compile(aevm, ContractName),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user