Skip to content

Commit

Permalink
Merge pull request #8728 from bjorng/bjorn/kernel/fix-error-explanation
Browse files Browse the repository at this point in the history
Fix error information for `code:get_coverage/2`
  • Loading branch information
bjorng authored Aug 19, 2024
2 parents 0881e4e + 49288c0 commit 5da80a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/kernel/src/erl_kernel_errors.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ format_code_error(get_coverage, [What,Module]) ->
Error = case What of
function -> [];
line -> [];
_ -> <<"must be one of: function or line">>
cover_line_id -> [];
_ -> coverage_level
end,
case Error of
[] ->
Expand Down Expand Up @@ -367,6 +368,8 @@ expand_error(bad_tracer) ->
<<"invalid tracer">>;
expand_error(coverage_disabled) ->
<<"not loaded with coverage enabled">>;
expand_error(coverage_level) ->
<<"must be one of: function, line, or cover_line_id">>;
expand_error(eq_in_list) ->
<<"\"=\" characters is not allowed in environment variable names">>;
expand_error(zero_in_list) ->
Expand Down
1 change: 1 addition & 0 deletions lib/kernel/test/code_coverage_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ error_info(_Config) ->
{get_coverage, [line,42]},
{get_coverage, [line,NotLoaded]},
{get_coverage, [line,?MODULE]},
{get_coverage, [cover_line_id,NotLoaded]},
{get_coverage, [whatever,?MODULE]},

{reset_coverage, [42]},
Expand Down

0 comments on commit 5da80a1

Please sign in to comment.