Skip to content

Commit

Permalink
Improve error reporting (as an exit with data) when a parsed file can…
Browse files Browse the repository at this point in the history
…'t be found, instead of a badmatch.

Signed-off-by: Fred Dushin <[email protected]>
  • Loading branch information
fadushin committed Oct 12, 2023
1 parent be939d9 commit a7b372e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/packbeam_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,18 @@ get_data(ParsedFile) ->

%% @private
get_parsed_file(Module, ParsedFiles) ->
{value, V} = lists:search(
SearchResult = lists:search(
fun(ParsedFile) ->
proplists:get_value(module, ParsedFile) =:= Module
end,
ParsedFiles
),
V.
case SearchResult of
{value, V} ->
V;
false ->
exit({module_not_found, Module, ParsedFiles})
end.

%% @private
intersection(A, B) ->
Expand Down

0 comments on commit a7b372e

Please sign in to comment.