Central handling of network errors, fixes #39
Merged