Skip to content

Commit

Permalink
fix: Handle non JSON responses from api.near.social
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley committed Jun 29, 2023
1 parent b02cd50 commit 29575ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion indexer-js-queue-handler/latest-post-metrics-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ export const handler = async () => {
}),
});

const [{ blockHeight }] = await response.json();
const body = await response.text();

if (response.status !== 200) {
throw new Error(body);
}

const [{ blockHeight }] = JSON.parse(body);

await metrics.putBlockHeight("social.near", "posts", blockHeight);
};

0 comments on commit 29575ed

Please sign in to comment.