From 9099a788cd7124024559c064e425ed9caef6e0ac Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Fri, 22 Jul 2016 16:28:12 -0700 Subject: [crosperf] Clean up exceptions. Found all instances of 'raise Exception' and changed them to raise something slightly more specific. Changed a few 'except Exception' statements appropriately as well. BUG=chromium:566255 TEST=None Change-Id: If2666bd55838342bc71431e5e6ab2157c2c9e125 Reviewed-on: https://chrome-internal-review.googlesource.com/270731 Commit-Ready: Caroline Tice Tested-by: Caroline Tice Reviewed-by: Yunlian Jiang --- cros_utils/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cros_utils/misc.py') diff --git a/cros_utils/misc.py b/cros_utils/misc.py index ae234fe3..79a56585 100644 --- a/cros_utils/misc.py +++ b/cros_utils/misc.py @@ -62,7 +62,7 @@ def UnitToNumber(unit_num, base=1000): for k, v in unit_dict.items(): if k.startswith(unit): return float(number) * v - raise Exception('Unit: %s not found in byte: %s!' % (unit, unit_num)) + raise RuntimeError('Unit: %s not found in byte: %s!' % (unit, unit_num)) def GetFilenameFromString(string): @@ -86,8 +86,8 @@ def GetChrootPath(chromeos_root): def GetInsideChrootPath(chromeos_root, file_path): if not file_path.startswith(GetChrootPath(chromeos_root)): - raise Exception("File: %s doesn't seem to be in the chroot: %s" % - (file_path, chromeos_root)) + raise RuntimeError("File: %s doesn't seem to be in the chroot: %s" % + (file_path, chromeos_root)) return file_path[len(GetChrootPath(chromeos_root)):] -- cgit v1.2.3