[ui] error-proofing table formatters

feat/vaults
Tomáš Mládek 2022-01-08 19:05:01 +01:00
parent f75c74a266
commit 3421523585
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 6 additions and 4 deletions

View File

@ -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 = [];