1
0
Fork 0

tooltip: better error reporting on failed mapping.

This commit is contained in:
Thomas Geymayer 2014-06-21 12:03:35 +02:00
parent 9b4a1b52a4
commit 717c684dad

View file

@ -118,8 +118,19 @@ var Tooltip = {
{ {
var msg = me._label; var msg = me._label;
if (me._property != nil) { if (me._property != nil) {
var val = me._remapValue(me._property.getValue() or 0); var val = me._property.getValue() or 0;
msg = sprintf(me._label, val);
# https://code.google.com/p/flightgear-bugs/issues/detail?id=1454
# wrap mapping in 'call' to catch conversion errors
var val_mapped = call(me._remapValue, [val], me, nil, var err = []);
if( size(err) )
printlog(
"warn",
"Tooltip: failed to remap " ~ debug.string(me._property, 0) ~ ":\n"
~ debug.string(err, 0)
);
msg = sprintf(me._label, val_mapped or val);
} }
me._text.setText(msg); me._text.setText(msg);