diff options
author | Caroline Tice <cmtice@google.com> | 2016-07-22 16:28:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-27 07:23:18 -0700 |
commit | 9099a788cd7124024559c064e425ed9caef6e0ac (patch) | |
tree | 87df663ff83ab398121cd66e9528422979a63cf6 /cros_utils | |
parent | 19e119b46c14f57988ba3504369e815d3aab0122 (diff) | |
download | toolchain-utils-9099a788cd7124024559c064e425ed9caef6e0ac.tar.gz |
[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 <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'cros_utils')
-rw-r--r-- | cros_utils/file_utils.py | 2 | ||||
-rw-r--r-- | cros_utils/manifest_versions.py | 4 | ||||
-rw-r--r-- | cros_utils/misc.py | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/cros_utils/file_utils.py b/cros_utils/file_utils.py index b7aad7b3..777e6251 100644 --- a/cros_utils/file_utils.py +++ b/cros_utils/file_utils.py @@ -32,7 +32,7 @@ class FileUtils(object): ce = command_executer.GetCommandExecuter(log_level=log_level) ret, out, _ = ce.RunCommandWOutput(command) if ret: - raise Exception('Could not run md5sum on: %s' % filename) + raise RuntimeError('Could not run md5sum on: %s' % filename) return out.strip().split()[0] diff --git a/cros_utils/manifest_versions.py b/cros_utils/manifest_versions.py index f011282b..52fd700f 100644 --- a/cros_utils/manifest_versions.py +++ b/cros_utils/manifest_versions.py @@ -92,6 +92,6 @@ class ManifestVersions(object): command = 'cp {0} {1}'.format(files[0], to_file) ret = self.ce.RunCommand(command) if ret: - raise Exception('Cannot copy manifest to {0}'.format(to_file)) + raise RuntimeError('Cannot copy manifest to {0}'.format(to_file)) else: - raise Exception('Version {0} is not available.'.format(version)) + raise RuntimeError('Version {0} is not available.'.format(version)) 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)):] |