Fix a bug when handling errors during a fetch.