[ui] error-proofing table formatters
This commit is contained in:
parent
f75c74a266
commit
3421523585
1 changed files with 6 additions and 4 deletions
|
@ -176,15 +176,17 @@
|
||||||
return ATTRIBUTE_LABELS[attribute];
|
return ATTRIBUTE_LABELS[attribute];
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(
|
function formatValue(value: string | number, attribute: string): string {
|
||||||
value: string | number,
|
|
||||||
attribute: string
|
|
||||||
): string | undefined {
|
|
||||||
const handler = VALUE_FORMATTERS[attribute];
|
const handler = VALUE_FORMATTERS[attribute];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
|
try {
|
||||||
return handler(value);
|
return handler(value);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Error while formatting "${value}": ${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
|
||||||
// Optimizations
|
// Optimizations
|
||||||
let resolve = [];
|
let resolve = [];
|
||||||
|
|
Loading…
Reference in a new issue