-
-
Notifications
You must be signed in to change notification settings - Fork 276
Pkg.Registry.update()
: add throw_on_error
kwarg
#4245
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
base: master
Are you sure you want to change the base?
Conversation
Hmmm. I think I should wait until the end, instead of throwing immediately. |
I don't really like this because |
In particular, the network might be down, but you still want to do the Project.toml modification. |
How about we set @omus I think that would still solve your use case, right? |
Pkg.Registry.update()
: throw if an error is encounteredPkg.Registry.update()
: add throw_on_error
kwarg
I have implemented this. |
Pkg.Registry.update()
: add throw_on_error
kwargPkg.Registry.update()
: add throw_on_error
kwarg
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'm onboard with this change. My in my use case I want this to fail fast to avoid spending time on adding packages when it will eventually fail
@error warn_str | ||
if throw_on_error | ||
Pkg.Types.pkgerror(warn_str) | ||
end |
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.
Do we want to both have an @error
and an exception?
@@ -392,7 +392,7 @@ function update(; name=nothing, uuid=nothing, url=nothing, path=nothing, linked= | |||
update([RegistrySpec(; name, uuid, url, path, linked)]; kwargs...) | |||
end | |||
end | |||
function update(regs::Vector{RegistrySpec}; io::IO=stderr_f(), force::Bool=true, depots = [depots1()], update_cooldown = Second(1)) | |||
function update(regs::Vector{RegistrySpec}; io::IO=stderr_f(), force::Bool=true, depots = [depots1()], update_cooldown = Second(1), throw_on_error = false) |
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.
Maybe could be:
function update(regs::Vector{RegistrySpec}; io::IO=stderr_f(), force::Bool=true, depots = [depots1()], update_cooldown = Second(1), throw_on_error = false) | |
function update(regs::Vector{RegistrySpec}; io::IO=stderr_f(), force::Bool=true, depots = [depots1()], update_cooldown = Second(1), strict::Bool=false) |
We already have a Pkg.precompile(; strict::Bool=false)
which reminds me of this
I think that So the options that we are considering are:
Are there any other options that we can think of? |
I think just |
Fixes #4244
This PR adds the optional
throw_on_error
kwarg to thePkg.Registry.update()
function.The default value is
throw_on_error = false
, which preserves the existing behavior by default.However, if the user opts-in by specifying
throw_on_error = true
, then ifPkg.Registry.update()
encounters an error, we will throw an exception.The name
throw_on_error
can be bikeshedded.