When trying to upload an image (that was stored using ImagePicker) to a server using fetch, up pops a file-not-found error. This is to be expected, and my app could handle it. But the error pops up as a big red non-js error in dev mode on iOS (see screenshot). In prod-mode on iOS the error probably happens but is silently ignored.
How can I catch this error? Or, failing that, detect whether the file exists to avoid the error? On production, how can I detect whether this sort of error is happening? Is there any way to get general logs or error logs from running the published app on my phone?
Here’s the code: https://github.com/seveneightn9ne/pottery-log/blob/master/ImageUploader.js#L31
For some context, we’re sending to a server because of this: https://forums.expo.dev/t/images-from-imagepicker-disappear-occasionally/392 . The file doesn’t exist because the cache disappeared before it had the chance to upload.