mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-09 21:39:09 +08:00
Error messages in parsing variables (#722)
Making error messages more clear when a vector or scalar is found in macro parsing, and the other type is expected.
This commit is contained in:
parent
8dd5fe83fc
commit
ac904b2731
@ -623,7 +623,7 @@ namespace client
|
|||||||
expr<Iterator> &output)
|
expr<Iterator> &output)
|
||||||
{
|
{
|
||||||
if (opt.opt->is_vector())
|
if (opt.opt->is_vector())
|
||||||
ctx->throw_exception("Referencing a scalar variable in a vector context", opt.it_range);
|
ctx->throw_exception("Referencing a vector variable when scalar is expected", opt.it_range);
|
||||||
switch (opt.opt->type()) {
|
switch (opt.opt->type()) {
|
||||||
case coFloat: output.set_d(opt.opt->getFloat()); break;
|
case coFloat: output.set_d(opt.opt->getFloat()); break;
|
||||||
case coInt: output.set_i(opt.opt->getInt()); break;
|
case coInt: output.set_i(opt.opt->getInt()); break;
|
||||||
@ -648,7 +648,7 @@ namespace client
|
|||||||
expr<Iterator> &output)
|
expr<Iterator> &output)
|
||||||
{
|
{
|
||||||
if (opt.opt->is_scalar())
|
if (opt.opt->is_scalar())
|
||||||
ctx->throw_exception("Referencing a vector variable in a scalar context", opt.it_range);
|
ctx->throw_exception("Referencing a scalar variable when vector is expected", opt.it_range);
|
||||||
const ConfigOptionVectorBase *vec = static_cast<const ConfigOptionVectorBase*>(opt.opt);
|
const ConfigOptionVectorBase *vec = static_cast<const ConfigOptionVectorBase*>(opt.opt);
|
||||||
if (vec->empty())
|
if (vec->empty())
|
||||||
ctx->throw_exception("Indexing an empty vector variable", opt.it_range);
|
ctx->throw_exception("Indexing an empty vector variable", opt.it_range);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user