Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort when file:consult/1 returns an error in rebar3_hex_repos:auth_config/1 #2022

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

starbelly
Copy link
Contributor

@starbelly starbelly commented Feb 19, 2019

  • Modified rebar_hex_repos:auth_config/1 to abort on error except in
    the case of enoent, in which we return an empty map.

Example output for the two unhappy cases:

===> Error found in auth config (/Users/starbelly/.config/rebar3/hex.config) at line 3: syntax error before: '=>'

and

===> Error reading auth config (/Users/starbelly/.config/rebar3/hex.config) : eacces

TODO:

  • needs test

@starbelly starbelly mentioned this pull request Feb 19, 2019
6 tasks
@starbelly starbelly changed the title WIP: Abort when file:consult/1 returns an error WIP: Abort when file:consult/1 returns an error in rebar3_hex_repos:auth_config/1 Feb 19, 2019
@ferd
Copy link
Collaborator

ferd commented Feb 19, 2019

Sounds reasonable, awaiting the test(s)

@starbelly starbelly force-pushed the abort-on-auth-config-syntax-error branch from 141e4e2 to ac59e14 Compare February 19, 2019 20:20
@starbelly starbelly changed the title WIP: Abort when file:consult/1 returns an error in rebar3_hex_repos:auth_config/1 Abort when file:consult/1 returns an error in rebar3_hex_repos:auth_config/1 Feb 19, 2019
@starbelly
Copy link
Contributor Author

starbelly commented Feb 19, 2019

@ferd Okie dokie, have a look at the test. The only way I can think of improving the test is capturing the output and/or not mock file:consult/1 and instead mock rebar_dir:global_config_dir/1

src/rebar_hex_repos.erl Outdated Show resolved Hide resolved
@ferd
Copy link
Collaborator

ferd commented Feb 20, 2019

Current tests seem fine. There's one call to unexport since it's unused.

 - Modified rebar_hex_repos:auth_config/1 to abort on error except in
 the case of enoent, in which we return an empty map.
 - added auth_config_errors test to test/rebar_pkg_repos_SUITE
@starbelly starbelly force-pushed the abort-on-auth-config-syntax-error branch from ac59e14 to 6379510 Compare February 21, 2019 01:04
@ferd ferd merged commit 9e2e54a into erlang:master Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants