How do I handle JavaScript Fetch errors?
It seems likely that there aren't any more details for networking/permission/input problems.
Is it possible to distinguish fetch errors from other TypeErrors?
Yes, you just need to catch
only the the errors from the fetch
call:
fetch(…).catch(err => new FetchError(err)).…class FetchError extends Error { constructor(orig) { super(); this.message = "fetch error"; this.details = orig; }}