[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];
|
||||
}
|
||||
|
||||
function formatValue(
|
||||
value: string | number,
|
||||
attribute: string
|
||||
): string | undefined {
|
||||
function formatValue(value: string | number, attribute: string): string {
|
||||
const handler = VALUE_FORMATTERS[attribute];
|
||||
if (handler) {
|
||||
try {
|
||||
return handler(value);
|
||||
} catch (error) {
|
||||
console.warn(`Error while formatting "${value}": ${error}`);
|
||||
}
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
// Optimizations
|
||||
let resolve = [];
|
||||
|
|
Loading…
Reference in a new issue