From 445e863b9803030a0c676a5e245683d9a4e2ba05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 18 Jul 2019 19:26:53 -0600 Subject: [PATCH 1/3] Allow arbitrary number of arguments to submit --- src/attributes.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/attributes.jl b/src/attributes.jl index b75b615a65..7a538d0d15 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -377,9 +377,9 @@ end """ submit(optimizer::AbstractOptimizer, sub::AbstractSubmittable, - value)::Nothing + values...)::Nothing -Submit `value` to the submittable `sub` of the optimizer `optimizer`. +Submit `values` to the submittable `sub` of the optimizer `optimizer`. An [`UnsupportedSubmittable`](@ref) error is thrown if `model` does not support the attribute `attr` (see [`supports`](@ref)) and a [`SubmitNotAllowed`](@ref) From f00ba2cb2da0823f689d91274c3557c9b7aebc74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 18 Jul 2019 21:09:44 -0600 Subject: [PATCH 2/3] Throw MethodError --- src/attributes.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/attributes.jl b/src/attributes.jl index 7a538d0d15..860849a61a 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -388,7 +388,7 @@ error is thrown if it supports the submittable `sub` but it cannot be submitted. function submit end function submit(model::ModelLike, sub::AbstractSubmittable, args...) if supports(model, sub) - throw(SubmitNotAllowed(sub)) + throw(MethodError(submit, (model, sub, args...))) else throw(UnsupportedSubmittable(sub)) end From 9f15e1bd8cb3ccbd836cbb5f0bc30df4918a5dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 18 Jul 2019 21:50:19 -0600 Subject: [PATCH 3/3] Throw ArgumentError --- src/attributes.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/attributes.jl b/src/attributes.jl index 860849a61a..bd8eb095ec 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -388,7 +388,8 @@ error is thrown if it supports the submittable `sub` but it cannot be submitted. function submit end function submit(model::ModelLike, sub::AbstractSubmittable, args...) if supports(model, sub) - throw(MethodError(submit, (model, sub, args...))) + throw(ArgumentError( + "Submitting $(typeof.(args)) for `$(typeof(sub))` is not valid.")) else throw(UnsupportedSubmittable(sub)) end