comparison mercurial/error.py @ 31959:b445a3f00528

stdio: add machinery to identify failed stdout/stderr writes Mercurial currently fails to notice failures to write to stdout or stderr. A correctly functioning command line tool should detect this and exit with an error code. To achieve this, we need a little extra plumbing, which we start adding here.
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 11 Apr 2017 14:54:12 -0700
parents 0ca00905f769
children bf855efe5664
comparison
equal deleted inserted replaced
31958:de5c9d0e02ea 31959:b445a3f00528
119 class CapabilityError(RepoError): 119 class CapabilityError(RepoError):
120 pass 120 pass
121 121
122 class RequirementError(RepoError): 122 class RequirementError(RepoError):
123 """Exception raised if .hg/requires has an unknown entry.""" 123 """Exception raised if .hg/requires has an unknown entry."""
124
125 class StdioError(IOError):
126 """Raised if I/O to stdout or stderr fails"""
127
128 def __init__(self, err):
129 IOError.__init__(self, err.errno, err.strerror)
124 130
125 class UnsupportedMergeRecords(Abort): 131 class UnsupportedMergeRecords(Abort):
126 def __init__(self, recordtypes): 132 def __init__(self, recordtypes):
127 from .i18n import _ 133 from .i18n import _
128 self.recordtypes = sorted(recordtypes) 134 self.recordtypes = sorted(recordtypes)