Skip to content

Commit

Permalink
fix: Repair to not throw errors when data is not authentica or not ac…
Browse files Browse the repository at this point in the history
…cessible withing getDataFromExternalSources.
  • Loading branch information
richtera committed Jan 15, 2024
1 parent 0c212ad commit b5aab72
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib/getDataFromExternalSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,17 @@ export const getDataFromExternalSources = (
}
return response.json();
});
if (isDataAuthentic(receivedData, urlDataWithHash.verification)) {
return dataEntry;
}
console.error(
`GET request to ${urlDataWithHash.url} did not correctly validate`,
);
} catch (error) {
console.error(error, `GET request to ${urlDataWithHash.url} failed`);
throw error;
}

return isDataAuthentic(receivedData, urlDataWithHash.verification)
? { ...dataEntry, value: receivedData }
: { ...dataEntry, value: null };
// Invalid data
return { ...dataEntry, value: null };
});

return Promise.all(promises);
Expand Down

0 comments on commit b5aab72

Please sign in to comment.