-
Notifications
You must be signed in to change notification settings - Fork 351
Raise if version is not provided in Docs task config #729
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
Raise if version is not provided in Docs task config #729
Conversation
lib/mix/tasks/docs.ex
Outdated
end | ||
|
||
defp fetch_version!(config) do | ||
try do |
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.
Prefer using an implicit try
rather than explicit try
.
aba73f6
to
cbd6b32
Compare
lib/mix/tasks/docs.ex
Outdated
end | ||
|
||
defp fetch_version!(config) do | ||
Keyword.fetch!(config, :version) |
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 we are going to raise, then we should use Keyword.fetch + pattern matching.
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.
I.e. we shouldn't rescue exceptions. I believe when @ericmj mentioned Keyword.fetch!
he was not expecting a custom error message.
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.
Sorry, this was really wrong. Too tired I guess 😫
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.
fixed
I don't think we need a custom error message since it should always be caught by the compiler. Just using |
cbd6b32
to
67b4f37
Compare
@ericmj It will be caught. I thought it was better to give a more meaningful message. But it's up to you guys |
❤️ 💚 💙 💛 💜 |
It will raise with ArgumentError if :version key is not provided in config.
/cc @ericmj