catch icon generation errors and log to console (#441)

This commit is contained in:
James Wilson
2022-01-07 20:37:07 +00:00
committed by GitHub
parent bb9f257397
commit b4fd955c78
+9 -2
View File
@@ -174,7 +174,14 @@ function getColors(address: string): string[] {
* @description Generate a array of the circles that make up an indenticon
*/
function generate(address: string, isSixPoint = false): Circle[] {
const colors = getColors(address);
let colors: string[] = [];
try {
colors = getColors(address);
} catch (e) {
console.error(
`Error decoding address to generate validator icon for: ${address} (${e})`
);
}
return [OUTER_CIRCLE].concat(
getCircleXY(isSixPoint).map(
@@ -183,7 +190,7 @@ function generate(address: string, isSixPoint = false): Circle[] {
cx,
cy,
r: Z,
fill: colors[index],
fill: colors[index] || 'rgb(255,255,255)',
};
}
)