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 2c52300 commit eb96ab4
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 eb96ab4

Please sign in to comment.