Mercurial > public > mercurial-scm > hg
comparison mercurial/error.py @ 32002:bf855efe5664
httppeer: wrap HTTPResponse.read() globally
There were a handful of places in the code where HTTPResponse.read()
was called with no explicit error handling or with inconsistent
error handling. In order to eliminate this class of bug, we globally
swap out HTTPResponse.read() with a unified error handler.
I initially attempted to fix all call sites. However, after
going down that rabbit hole, I figured it was best to just change
read() to do what we want. This appears to be a worthwhile
change, as the tests demonstrate many of our uncaught exceptions
go away.
To better represent this class of failure, we introduce a new
error type. The main benefit over IOError is it can hold a hint.
I'm receptive to tweaking its name or inheritance.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 14 Apr 2017 00:33:56 -0700 |
parents | b445a3f00528 |
children | a29580905771 |
comparison
equal
deleted
inserted
replaced
32001:c85f19c66e8d | 32002:bf855efe5664 |
---|---|
250 class UnsupportedBundleSpecification(Exception): | 250 class UnsupportedBundleSpecification(Exception): |
251 """error raised when a bundle specification is not supported.""" | 251 """error raised when a bundle specification is not supported.""" |
252 | 252 |
253 class CorruptedState(Exception): | 253 class CorruptedState(Exception): |
254 """error raised when a command is not able to read its state from file""" | 254 """error raised when a command is not able to read its state from file""" |
255 | |
256 class RichIOError(Abort): | |
257 """An IOError that can also have a hint attached.""" |