comparison mercurial/windows.py @ 9448:bc6b0fef9495

windows: provide filename in IOError exceptions This brings the Windows posixfile errors in line with the errors on other platforms.
author Steve Borho <steve@borho.org>
date Mon, 14 Sep 2009 19:53:43 -0500
parents 705278e70457
children 61e30f257c15 1f665246dab3
comparison
equal deleted inserted replaced
9442:080227f584a1 9448:bc6b0fef9495
15 # wrap osutil.posixfile to provide friendlier exceptions 15 # wrap osutil.posixfile to provide friendlier exceptions
16 def posixfile(name, mode='r', buffering=-1): 16 def posixfile(name, mode='r', buffering=-1):
17 try: 17 try:
18 return osutil.posixfile(name, mode, buffering) 18 return osutil.posixfile(name, mode, buffering)
19 except WindowsError, err: 19 except WindowsError, err:
20 raise IOError(err.errno, err.strerror) 20 raise IOError(err.errno, '%s: %s' % (name, err.strerror))
21 posixfile.__doc__ = osutil.posixfile.__doc__ 21 posixfile.__doc__ = osutil.posixfile.__doc__
22 22
23 class winstdout(object): 23 class winstdout(object):
24 '''stdout on windows misbehaves if sent through a pipe''' 24 '''stdout on windows misbehaves if sent through a pipe'''
25 25