Fixed style according to reviewer and a refactoring error

I had to create this CL due to comitting before the final comments in the last CL
http://review.webrtc.org/1157005/ in revision:
https://code.google.com/p/webrtc/source/detail?r=3642

Changed e.msg to e.fail_msg in logging.error in emulate.py

Added space to error message for windows in check_permissions() in network_emulator

BUG=none
TEST=Windows and linux
Review URL: https://webrtc-codereview.appspot.com/1167006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3646 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jansson@webrtc.org 2013-03-11 14:52:56 +00:00
parent db8ca9a395
commit 0ef22c24c0
2 changed files with 4 additions and 4 deletions

View File

@ -154,7 +154,7 @@ def _main():
try:
emulator.check_permissions()
except network_emulator.NetworkEmulatorError as e:
logging.error('Error: %s\n\nCause: %s', e.msg, e.error)
logging.error('Error: %s\n\nCause: %s', e.fail_msg, e.error)
return -1
if not options.target_ip:
@ -186,7 +186,7 @@ def _main():
logging.info('Completed Network Emulation.')
return 0
except network_emulator.NetworkEmulatorError as e:
logging.error('Error: %s\n\nCause: %s', e.msg, e.error)
logging.error('Error: %s\n\nCause: %s', e.fail_msg, e.error)
return -2
if __name__ == '__main__':

View File

@ -97,7 +97,7 @@ class NetworkEmulator(object):
# AttributeError will be raised on Windows.
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
raise NetworkEmulatorError('You must run this script with administrator'
'privileges.')
' privileges.')
def _create_dummynet_rule(self, pipe_id, from_address, to_address,
port_range):
@ -169,7 +169,7 @@ def _run_ipfw_command(command, fail_msg=None):
fail_msg: Message describing the error in case the command fails.
Raises:
NetworkEmulatorError: If command fails. Message is set by the fail_msg
NetworkEmulatorError: If command fails a message is set by the fail_msg
parameter.
"""
if sys.platform == 'win32':