Skip to content

Commit

Permalink
catch exception on json parse failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspun-wandb committed Feb 21, 2025
1 parent 8084a47 commit 41ac864
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions weave-js/src/components/Panel2/PanelImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ const useClassLabels = (input: Node<typeof inputType>) => {

return useMemo(() => {
if (!(runConfigLoading || runTagLoading) && runTag != null) {
const configSubset: {[key: string]: any} = JSON.parse(
runTag.configSubset
);
return _.get(configSubset, '_wandb.value.mask/class_labels', {});
try {
const configSubset: {[key: string]: any} = JSON.parse(
runTag.configSubset
);
return _.get(configSubset, '_wandb.value.mask/class_labels', {});
} catch (error) {
console.error('Failed to parse config subset:', error);
return {};
}
}
return {};
}, [runTag, runTagLoading, runConfigLoading]);
Expand Down

0 comments on commit 41ac864

Please sign in to comment.