Skip to content

Commit 7de0693

Browse files
committed
Add another
1 parent b0c410f commit 7de0693

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/Bridges/Constraint/bridges/QuadtoSOCBridge.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ function _primal_start_or_error(model, attr, v)
256256
var_attr = MOI.VariablePrimalStart()
257257
value = MOI.get(model, MOI.VariablePrimalStart(), v)
258258
if isnothing(value)
259-
error(
260-
"In order to set the `$attr`, the",
261-
"`MOI.Bridges.Constraint.QuadtoSOCBridge` needs to get the ",
262-
"`$var_attr` but it is not set. Set the `$var_attr` first before ",
263-
"setting the `$attr` in order to fix this.",
264-
)
259+
msg =
260+
"In order to set the `$attr`, the " *
261+
"`MOI.Bridges.Constraint.QuadtoSOCBridge` needs to get the " *
262+
"`$var_attr` but it is not set. Set the `$var_attr` first before " *
263+
"setting the `$attr` in order to fix this."
264+
throw(MOI.SetAttributeNotAllowed(attr, msg))
265265
end
266266
return value
267267
end

test/Bridges/Constraint/QuadtoSOCBridge.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ function test_qcp()
164164
S = MOI.GreaterThan{Float64}
165165
ci = first(MOI.get(bridged_mock, MOI.ListOfConstraintIndices{F,S}()))
166166
for attr in [MOI.ConstraintPrimalStart(), MOI.ConstraintDualStart()]
167-
err = ErrorException(
168-
"In order to set the `$attr`, the`MOI.Bridges.Constraint.QuadtoSOCBridge` needs to get the `MathOptInterface.VariablePrimalStart()` but it is not set. Set the `MathOptInterface.VariablePrimalStart()` first before setting the `$attr` in order to fix this.",
169-
)
167+
msg = "In order to set the `$attr`, the`MOI.Bridges.Constraint.QuadtoSOCBridge` needs to get the `MathOptInterface.VariablePrimalStart()` but it is not set. Set the `MathOptInterface.VariablePrimalStart()` first before setting the `$attr` in order to fix this."
168+
err = MOI.SetAttributeNotAllowed(attr, msg)
170169
@test_throws err MOI.set(bridged_mock, attr, ci, 0.0)
171170
end
172171
return

0 commit comments

Comments
 (0)