This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
Error handling with node-fetch
Because window.fetch
isn't designed to transparent about the cause of request errors, we have to come up with our own solutions.
The basics:
-
All operational errors are rejected as FetchError, you can handle them all through promise
catch
clause. -
All errors comes with
err.message
detailing the cause of errors. -
All errors originated from
node-fetch
are marked with customerr.type
. -
All errors originated from Node.js core are marked with
err.type = system
, and contains additionerr.code
anderr.errno
for error handling, they are alias to error codes thrown by Node.js core. -
Programmer errors are either thrown as soon as possible, or rejected with default
Error
witherr.message
for ease of troubleshooting.
List of error types:
- Because we maintain 100% coverage, see test.js for a full list of custom
FetchError
types, as well as some of the common errors from Node.js