@@ -326,23 +326,24 @@ function Base.showerror(io::IO, err::UnexpectedSymbolicValueInVarmap)
326
326
end
327
327
328
328
struct MissingGuessError <: Exception
329
- sym :: Any
330
- val :: Any
329
+ syms :: Vector{ Any}
330
+ vals :: Vector{ Any}
331
331
end
332
332
333
333
function Base. showerror (io:: IO , err:: MissingGuessError )
334
334
println (io,
335
335
"""
336
336
Unable to resolve numeric guesses for all of the variables in the system. \
337
- This may be because your guesses are cyclic.
337
+ This may be because your guesses are cyclic. In order for the problem to be \
338
+ initialized, all of the variables must have a numeric value to serve as a \
339
+ starting point for the nonlinear solve.
338
340
339
- In order for the problem to be initialized, all of the variables must have \
340
- a numeric value to serve as a starting point for the nonlinear solve. \
341
- Please provide an additional numeric guess to `guesses` in \
342
- the problem constructor.
343
-
344
- This error was thrown because symbolic value $(err. val) was found for variable $(err. sym) .
341
+ Symbolic values were found for the following variables/parameters in the map; \
342
+ please provide additional numeric guesses so they can resolve to numbers:
345
343
""" )
344
+ for (sym, val) in zip (err. syms, err. vals)
345
+ println (sym, " => " , val)
346
+ end
346
347
end
347
348
348
349
"""
@@ -375,13 +376,17 @@ function better_varmap_to_vars(varmap::AbstractDict, vars::Vector;
375
376
end
376
377
vals = map (x -> varmap[x], vars)
377
378
if ! allow_symbolic
379
+ missingsyms = Any[]
380
+ missingvals = Any[]
378
381
for (sym, val) in zip (vars, vals)
379
382
symbolic_type (val) == NotSymbolic () && continue
380
- if is_initializeprob
381
- throw (MissingGuessError (sym, val))
382
- else
383
- throw (UnexpectedSymbolicValueInVarmap (sym, val))
384
- end
383
+ push! (missingsyms, sym)
384
+ push! (missingvals, val)
385
+ end
386
+
387
+ if ! isempty (missingsyms)
388
+ is_initializeprob ? throw (MissingGuessError (missingsyms, missingvals)) :
389
+ throw (UnexpectedSymbolicValueInVarmap (missingsyms[1 ], missingvals[1 ]))
385
390
end
386
391
end
387
392
0 commit comments