betaacid / expo-analytics

Google Analytics integration for use with React Native apps built on Expo
MIT License
288 stars 62 forks source link

Failed requests should fail gracefully #60

Closed FabianOMB closed 5 years ago

FabianOMB commented 5 years ago

If I use Sentry with my application it will report an error "Network request failed " if the call to google analytics fails (which of course it will sometimes).

This could be avoided by handling the error that occurs when fetch is called in the send method i.e add a catch to the fetch.

Line 138 in analytics.js could be updated like this:

return fetch(url, options).catch((e) => {console.log(e)});
FabianOMB commented 5 years ago

Realised that this of course should be handled at a higher level by the code calling analytics.hit.