From dfed9bf854c907054608a1a067d8ed1cf236058a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 3 Apr 2023 21:49:43 -0400 Subject: [PATCH] improve error messages --- src/region_block.cpp | 27 ++++++++++++--------------- src/region_cylinder.cpp | 12 ++++++------ src/region_sphere.cpp | 16 ++++++++-------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/region_block.cpp b/src/region_block.cpp index 8b50521d7c..e674cfc61c 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -515,44 +515,41 @@ void RegBlock::variable_check() // addition { if (xlostyle == VARIABLE) { xlovar = input->variable->find(xlostr); - if (xlovar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (xlovar < 0) error->all(FLERR, "Variable {} for region block does not exist", xlostr); if (!input->variable->equalstyle(xlovar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", xlostr); } - if (xhistyle == VARIABLE) { xhivar = input->variable->find(xhistr); - if (xhivar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (xhivar < 0) error->all(FLERR, "Variable {} for region block does not exist", xhistr); if (!input->variable->equalstyle(xhivar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", xhistr); } if (ylostyle == VARIABLE) { ylovar = input->variable->find(ylostr); - if (ylovar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (ylovar < 0) error->all(FLERR, "Variable {} for region block does not exist", ylostr); if (!input->variable->equalstyle(ylovar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", ylostr); } - if (yhistyle == VARIABLE) { yhivar = input->variable->find(yhistr); - if (yhivar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (yhivar < 0) error->all(FLERR, "Variable {} for region block does not exist", yhistr); if (!input->variable->equalstyle(yhivar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", yhistr); } if (zlostyle == VARIABLE) { zlovar = input->variable->find(zlostr); - if (zlovar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (zlovar < 0) error->all(FLERR, "Variable {} for region block does not exist", zlostr); if (!input->variable->equalstyle(zlovar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", zlostr); } - if (zhistyle == VARIABLE) { zhivar = input->variable->find(zhistr); - if (zhivar < 0) error->all(FLERR, "Variable name for region block does not exist"); + if (zhivar < 0) error->all(FLERR, "Variable {} for region block does not exist", zhistr); if (!input->variable->equalstyle(zhivar)) - error->all(FLERR, "Variable for region block is invalid style"); + error->all(FLERR, "Variable {} for region block is invalid style", zhistr); } } diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index c6119c0c3b..601f70e66b 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -793,23 +793,23 @@ void RegCylinder::variable_check() { if (c1style == VARIABLE) { c1var = input->variable->find(c1str); - if (c1var < 0) error->all(FLERR, "Variable name for region cylinder does not exist"); + if (c1var < 0) error->all(FLERR, "Variable {} for region cylinder does not exist", c1str); if (!input->variable->equalstyle(c1var)) - error->all(FLERR, "Variable for region cylinder is invalid style"); + error->all(FLERR, "Variable {} for region cylinder is invalid style", c1str); } if (c2style == VARIABLE) { c2var = input->variable->find(c2str); - if (c2var < 0) error->all(FLERR, "Variable name for region cylinder does not exist"); + if (c2var < 0) error->all(FLERR, "Variable {} for region cylinder does not exist", c2str); if (!input->variable->equalstyle(c2var)) - error->all(FLERR, "Variable for region cylinder is invalid style"); + error->all(FLERR, "Variable {} for region cylinder is invalid style", c2str); } if (rstyle == VARIABLE) { rvar = input->variable->find(rstr); - if (rvar < 0) error->all(FLERR, "Variable name for region cylinder does not exist"); + if (rvar < 0) error->all(FLERR, "Variable {} for region cylinder does not exist", rstr); if (!input->variable->equalstyle(rvar)) - error->all(FLERR, "Variable for region cylinder is invalid style"); + error->all(FLERR, "Variable {} for region cylinder is invalid style", rstr); } } diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index b67e805ac4..cd20a697d4 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -217,30 +217,30 @@ void RegSphere::variable_check() { if (xstyle == VARIABLE) { xvar = input->variable->find(xstr); - if (xvar < 0) error->all(FLERR, "Variable name for region sphere does not exist"); + if (xvar < 0) error->all(FLERR, "Variable {} for region sphere does not exist", xstr); if (!input->variable->equalstyle(xvar)) - error->all(FLERR, "Variable for region sphere is invalid style"); + error->all(FLERR, "Variable {} for region sphere is invalid style", xstr); } if (ystyle == VARIABLE) { yvar = input->variable->find(ystr); - if (yvar < 0) error->all(FLERR, "Variable name for region sphere does not exist"); + if (yvar < 0) error->all(FLERR, "Variable {} for region sphere does not exist", ystr); if (!input->variable->equalstyle(yvar)) - error->all(FLERR, "Variable for region sphere is invalid style"); + error->all(FLERR, "Variable {} for region sphere is invalid style", ystr); } if (zstyle == VARIABLE) { zvar = input->variable->find(zstr); - if (zvar < 0) error->all(FLERR, "Variable name for region sphere does not exist"); + if (zvar < 0) error->all(FLERR, "Variable {} for region sphere does not exist", zstr); if (!input->variable->equalstyle(zvar)) - error->all(FLERR, "Variable for region sphere is invalid style"); + error->all(FLERR, "Variable {} for region sphere is invalid style", zstr); } if (rstyle == VARIABLE) { rvar = input->variable->find(rstr); - if (rvar < 0) error->all(FLERR, "Variable name for region sphere does not exist"); + if (rvar < 0) error->all(FLERR, "Variable {} for region sphere does not exist", rstr); if (!input->variable->equalstyle(rvar)) - error->all(FLERR, "Variable for region sphere is invalid style"); + error->all(FLERR, "Variable {} for region sphere is invalid style", rstr); } }