Skip to content

Commit b880938

Browse files
blegatodow
authored andcommitted
Make macro error satisfy JuMP style guide (#1700)
1 parent 29e68f3 commit b880938

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/macros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ end
997997
const EMPTYSTRING = ""
998998

999999
function macro_error(macroname, args, str...)
1000-
error("In @$macroname($(join(args,","))): ", str...)
1000+
error("In @$macroname($(join(args, ", "))): ", str...)
10011001
end
10021002

10031003
# Given a base_name and idxvars, returns an expression that constructs the name

test/constraint.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ function constraints_test(ModelType::Type{<:JuMP.AbstractModel})
189189
model = ModelType()
190190
@variable(model, x[1:2])
191191
err = ErrorException(
192-
"In @constraint(model,[3, x] in SecondOrderCone()): unable to add" *
193-
" the constraint because we don't recognize $([3, x]) as a valid " *
194-
"JuMP function."
192+
"In @constraint(model, [3, x] in SecondOrderCone()): unable to " *
193+
"add the constraint because we don't recognize $([3, x]) as a " *
194+
"valid JuMP function."
195195
)
196196
@test_throws err @constraint(model, [3, x] in SecondOrderCone())
197197
end
@@ -251,12 +251,12 @@ function constraints_test(ModelType::Type{<:JuMP.AbstractModel})
251251
model = ModelType()
252252
@variable(model, X[1:2, 1:2])
253253
err = ErrorException(
254-
"In @constraint(model,X in MOI.PositiveSemidefiniteConeSquare(2)):" *
254+
"In @constraint(model, X in MOI.PositiveSemidefiniteConeSquare(2)):" *
255255
" instead of `MathOptInterface.PositiveSemidefiniteConeSquare(2)`," *
256256
" use `JuMP.PSDCone()`.")
257257
@test_throws err @constraint(model, X in MOI.PositiveSemidefiniteConeSquare(2))
258258
err = ErrorException(
259-
"In @constraint(model,X in MOI.PositiveSemidefiniteConeTriangle(2)):" *
259+
"In @constraint(model, X in MOI.PositiveSemidefiniteConeTriangle(2)):" *
260260
" instead of `MathOptInterface.PositiveSemidefiniteConeTriangle(2)`," *
261261
" use `JuMP.PSDCone()`.")
262262
@test_throws err @constraint(model, X in MOI.PositiveSemidefiniteConeTriangle(2))
@@ -266,7 +266,7 @@ function constraints_test(ModelType::Type{<:JuMP.AbstractModel})
266266
model = ModelType()
267267
@variable(model, X[1:2, 1:2])
268268
err = ErrorException(
269-
"In @constraint(model,X in MOI.SecondOrderCone(4)): unexpected " *
269+
"In @constraint(model, X in MOI.SecondOrderCone(4)): unexpected " *
270270
"matrix in vector constraint. Do you need to flatten the matrix " *
271271
"into a vector using `vec()`?")
272272
# Note: this should apply to any MOI.AbstractVectorSet. We just pick

0 commit comments

Comments
 (0)