mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
Add exception handlers in places where scripts are invoked. This should lead to slightly nicer error messages.
This commit is contained in:
@@ -480,12 +480,16 @@ void StatsPanel::showCategory(const GraphType* prefer_layout) {
|
||||
GraphElementP e(new GraphElement(i));
|
||||
bool show = true;
|
||||
FOR_EACH(dim, dims) {
|
||||
String value = untag(dim->script.invoke(ctx)->toString());
|
||||
e->values.push_back(value);
|
||||
if (value.empty() && !dim->show_empty) {
|
||||
// don't show this element
|
||||
show = false;
|
||||
break;
|
||||
try {
|
||||
String value = untag(dim->script.invoke(ctx)->toString());
|
||||
e->values.push_back(value);
|
||||
if (value.empty() && !dim->show_empty) {
|
||||
// don't show this element
|
||||
show = false;
|
||||
break;
|
||||
}
|
||||
} catch (ScriptError const& e) {
|
||||
handle_error(ScriptError(e.what() + _("\n in script for statistics dimension '") + dim->name + _("'")));
|
||||
}
|
||||
}
|
||||
if (show) {
|
||||
|
||||
Reference in New Issue
Block a user