diff --git a/src/Bridges/bridge.jl b/src/Bridges/bridge.jl index 3b7508f7c2..fdbf33ed9a 100644 --- a/src/Bridges/bridge.jl +++ b/src/Bridges/bridge.jl @@ -84,7 +84,14 @@ function MOI.get( ) return throw( ArgumentError( - "Bridge of type `$(typeof(bridge))` does not support accessing the attribute `$attr`.", + "Bridge of type `$(typeof(bridge))` does not support accessing " * + "the attribute `$attr`. If you encountered this error " * + "unexpectedly, it probably means your model has been " * + "reformulated using the bridge, and you are attempting to query " * + "an attribute that we haven't implemented yet for this bridge. " * + "Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " * + "and provide a reproducible example explaining what you were " * + "trying to do.", ), ) end diff --git a/test/Bridges/Variable/zeros.jl b/test/Bridges/Variable/zeros.jl index 66f1ae26f5..77a0371c08 100644 --- a/test/Bridges/Variable/zeros.jl +++ b/test/Bridges/Variable/zeros.jl @@ -116,13 +116,19 @@ err = ArgumentError( @test MOI.get(bridged_mock, MOI.ConstraintDual(), cx) == 0.0 @test MOI.get(bridged_mock, MOI.ConstraintDual(), c1) == 0.0 @test MOI.get(bridged_mock, MOI.ConstraintDual(), c2) == 1.0 - + bridge = MathOptInterface.Bridges.Variable.ZerosBridge{Float64} + attr = MOI.ConstraintDual() err = ArgumentError( - "Bridge of type `MathOptInterface.Bridges.Variable.ZerosBridge{Float64}`" * - " does not support accessing the attribute" * - " `MathOptInterface.ConstraintDual(1)`.", + "Bridge of type `$(bridge)` does not support accessing " * + "the attribute `$attr`. If you encountered this error " * + "unexpectedly, it probably means your model has been " * + "reformulated using the bridge, and you are attempting to query " * + "an attribute that we haven't implemented yet for this bridge. " * + "Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " * + "and provide a reproducible example explaining what you were " * + "trying to do.", ) - @test_throws err MOI.get(bridged_mock, MOI.ConstraintDual(), cyz) + @test_throws err MOI.get(bridged_mock, attr, cyz) end @testset "Query" begin diff --git a/test/Bridges/bridge_optimizer.jl b/test/Bridges/bridge_optimizer.jl index 4df4de40cb..fce8be17d6 100644 --- a/test/Bridges/bridge_optimizer.jl +++ b/test/Bridges/bridge_optimizer.jl @@ -158,10 +158,23 @@ bridged_mock = MOIB.Constraint.LessToGreater{Float64}( ) @testset "Unsupported constraint attribute" begin + bridge = MOI.Bridges.Constraint.SplitIntervalBridge{ + Float64, + MOI.SingleVariable, + MOI.Interval{Float64}, + MOI.GreaterThan{Float64}, + MOI.LessThan{Float64}, + } attr = MOIT.UnknownConstraintAttribute() err = ArgumentError( - "Bridge of type `$(MOI.Bridges.Constraint.SplitIntervalBridge{Float64,MOI.SingleVariable,MOI.Interval{Float64},MOI.GreaterThan{Float64},MOI.LessThan{Float64}})` " * - "does not support accessing the attribute `$attr`.", + "Bridge of type `$(bridge)` does not support accessing " * + "the attribute `$attr`. If you encountered this error " * + "unexpectedly, it probably means your model has been " * + "reformulated using the bridge, and you are attempting to query " * + "an attribute that we haven't implemented yet for this bridge. " * + "Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " * + "and provide a reproducible example explaining what you were " * + "trying to do.", ) x = MOI.add_variable(bridged_mock) ci = MOI.add_constraint(