tooltip: better error reporting on failed mapping.
This commit is contained in:
parent
9b4a1b52a4
commit
717c684dad
1 changed files with 24 additions and 13 deletions
|
@ -118,8 +118,19 @@ var Tooltip = {
|
|||
{
|
||||
var msg = me._label;
|
||||
if (me._property != nil) {
|
||||
var val = me._remapValue(me._property.getValue() or 0);
|
||||
msg = sprintf(me._label, val);
|
||||
var val = me._property.getValue() or 0;
|
||||
|
||||
# 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);
|
||||
|
|
Loading…
Reference in a new issue