@@ -26,21 +26,47 @@ function supports_constraint(
2626end
2727
2828"""
29- struct UnsupportedConstraint{F<:AbstractFunction, S<:AbstractSet} <: UnsupportedError
30- message::String # Human-friendly explanation why the attribute cannot be set
29+ struct UnsupportedConstraint{F<:AbstractFunction,S<:AbstractSet} <: UnsupportedError
30+ message::String
3131 end
3232
3333An error indicating that constraints of type `F`-in-`S` are not supported by
3434the model, that is, that [`supports_constraint`](@ref) returns `false`.
35+
36+ ```jldoctest
37+ julia> import MathOptInterface as MOI
38+
39+ julia> showerror(stdout, MOI.UnsupportedConstraint{MOI.VariableIndex,MOI.ZeroOne}())
40+ UnsupportedConstraint: `MathOptInterface.VariableIndex`-in-`MathOptInterface.ZeroOne` constraints are not supported by the
41+ solver you have chosen, and we could not reformulate your model into a
42+ form that is supported.
43+
44+ To fix this error you must choose a different solver.
45+
46+ ```
3547"""
3648struct UnsupportedConstraint{F<: AbstractFunction ,S<: AbstractSet } < :
3749 UnsupportedError
38- message:: String # Human-friendly explanation why the attribute cannot be set
50+ # Human-friendly explanation why the attribute cannot be set
51+ message:: String
3952end
53+
4054UnsupportedConstraint {F,S} () where {F,S} = UnsupportedConstraint {F,S} (" " )
4155
42- function element_name (:: UnsupportedConstraint{F,S} ) where {F,S}
43- return " `$F `-in-`$S ` constraint"
56+ function Base. showerror (io:: IO , err:: UnsupportedConstraint{F,S} ) where {F,S}
57+ print (
58+ io,
59+ """
60+ UnsupportedConstraint: `$F `-in-`$S ` constraints are not supported by the
61+ solver you have chosen, and we could not reformulate your model into a
62+ form that is supported.
63+
64+ To fix this error you must choose a different solver.
65+
66+ $(err. message)
67+ """ ,
68+ )
69+ return
4470end
4571
4672"""
0 commit comments