-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Init Config Improvement #260
Conversation
de0dc3d
to
d724172
Compare
os.Exit(1) | ||
} | ||
|
||
if !os.IsNotExist(errors.Cause(err)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the above code found a config file but there's parsing errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is a parse error then config
will be nil
and it will exit with 1
right? I think that's the correct behaviour. What do you think should happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah cool yeah that's what I am thinking too so we will need to handle that edge case then because I don't think
!os.IsNotExist(errors.Cause(err))
will catch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the !
— I know it's a bit hard to read, but it's checking for the opposite case; basically any error except file not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrmm okay I guess that makes sense.
Init Config Improvement
Init will currently fail with an obscure error message if a config file is found. This change fixes a couple of issues with the codepath, and outputs a better error message if a config file is located:
Also fixed a minor issue outputting the server filename.