Skip to content

Commit 79c19e0

Browse files
authored
Fix Exception supertype of LowerBoundAlreadySet and UpperBoundAlreadySet (#2397)
1 parent 9a790ca commit 79c19e0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/constraints.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Error thrown when setting a `VariableIndex`-in-`S2` when a
249249
set a lower bound, i.e. they are [`EqualTo`](@ref), [`GreaterThan`](@ref),
250250
[`Interval`](@ref), [`Semicontinuous`](@ref) or [`Semiinteger`](@ref).
251251
"""
252-
struct LowerBoundAlreadySet{S1,S2}
252+
struct LowerBoundAlreadySet{S1,S2} <: Exception
253253
vi::VariableIndex
254254
end
255255

@@ -271,7 +271,7 @@ Error thrown when setting a `VariableIndex`-in-`S2` when a
271271
set an upper bound, i.e. they are [`EqualTo`](@ref), [`LessThan`](@ref),
272272
[`Interval`](@ref), [`Semicontinuous`](@ref) or [`Semiinteger`](@ref).
273273
"""
274-
struct UpperBoundAlreadySet{S1,S2}
274+
struct UpperBoundAlreadySet{S1,S2} <: Exception
275275
vi::VariableIndex
276276
end
277277

test/constraints.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function test_LowerBoundAlreadySet_error()
4545
S1 = MOI.LessThan{Int}
4646
S2 = MOI.Interval{Int}
4747
err = MOI.LowerBoundAlreadySet{S1,S2}(x)
48+
@test err isa Exception
4849
@test sprint(showerror, err) ==
4950
"$(typeof(err)): Cannot add `VariableIndex`-in-`$(S2)` constraint " *
5051
"for variable $(x) as a `VariableIndex`-in-`$(S1)` constraint was " *
@@ -57,6 +58,7 @@ function test_UpperBoundAlreadySet_error()
5758
S1 = MOI.GreaterThan{Int}
5859
S2 = MOI.Interval{Int}
5960
err = MOI.UpperBoundAlreadySet{S1,S2}(x)
61+
@test err isa Exception
6062
@test sprint(showerror, err) ==
6163
"$(typeof(err)): Cannot add `VariableIndex`-in-`$(S2)` constraint " *
6264
"for variable $(x) as a `VariableIndex`-in-`$(S1)` constraint was " *

0 commit comments

Comments
 (0)