diff --git a/src/macros/@variable.jl b/src/macros/@variable.jl index cfc88503453..13de6117a37 100644 --- a/src/macros/@variable.jl +++ b/src/macros/@variable.jl @@ -675,9 +675,25 @@ function build_variable( ) end error_fn( - "Unrecognized keyword argument: $key.\n\nIf you're trying " * - "to create a JuMP extension, you need to implement " * - "`build_variable`. Read the docstring for more details.", + """ + Unrecognized keyword argument: $key. + + The supported keyword arguments are: + + * `base_name` + * `binary` + * `container` + * `integer` + * `lower_bound` + * `set` + * `set_string_name` + * `start` + * `upper_bound` + * `variable_type` + + If you're trying to create a JuMP extension, you need to implement `JuMP.build_variable`. + See the docstring for more details. + """, ) end if info.lower_bound isa AbstractArray diff --git a/test/test_macros.jl b/test/test_macros.jl index 9a144f7126d..2321b8deaf9 100644 --- a/test/test_macros.jl +++ b/test/test_macros.jl @@ -914,10 +914,25 @@ end function test_unrecognized_kwarg() model = Model() err = ErrorException( - "In `@variable(model, x, foo = 1)`: " * - "Unrecognized keyword argument: foo.\n\nIf you're trying to " * - "create a JuMP extension, you need to implement " * - "`build_variable`. Read the docstring for more details.", + """ + In `@variable(model, x, foo = 1)`: Unrecognized keyword argument: foo. + + The supported keyword arguments are: + + * `base_name` + * `binary` + * `container` + * `integer` + * `lower_bound` + * `set` + * `set_string_name` + * `start` + * `upper_bound` + * `variable_type` + + If you're trying to create a JuMP extension, you need to implement `JuMP.build_variable`. + See the docstring for more details. + """, ) @test_throws_runtime err @variable(model, x, foo = 1) return