Better error-handling for network code.