Skip to content

Commit

Permalink
fix: prevent excessive warns (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalstruck authored Nov 20, 2024
1 parent d427074 commit 8d40836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ export const createTransactionHashUrl = (
export const tryParseJSON = <T extends {}>(
input: string | null | undefined,
): T | null => {
if (input == null) return null;
if (!input) return null;
try {
const o = JSON.parse(input);

if (o && typeof o === "object") {
return o;
}
} catch (e) {
console.warn("Error parsing JSON", { error: e, input });
console.warn("Error parsing JSON", { error: JSON.stringify(e), input });
return null;
}

Expand Down

0 comments on commit 8d40836

Please sign in to comment.