From 11b77e8b2dd089b8f9156e6b918d5893bf02eda6 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Tue, 14 Jun 2022 10:51:51 -0600 Subject: [PATCH] gaps: use ValueError for split Callers may want to catch that. --- subiquity/common/filesystem/gaps.py | 2 +- subiquity/common/filesystem/tests/test_gaps.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subiquity/common/filesystem/gaps.py b/subiquity/common/filesystem/gaps.py index 36f7f00f..59859c00 100644 --- a/subiquity/common/filesystem/gaps.py +++ b/subiquity/common/filesystem/gaps.py @@ -47,7 +47,7 @@ class Gap: the supplied size. If size is equal to the gap size, the second gap is None. The original gap is unmodified.""" if size > self.size: - raise Exception('requested size larger than gap') + raise ValueError('requested size larger than gap') if size == self.size: return (self, None) first_gap = Gap(device=self.device, diff --git a/subiquity/common/filesystem/tests/test_gaps.py b/subiquity/common/filesystem/tests/test_gaps.py index 304feadf..1a09fc4c 100644 --- a/subiquity/common/filesystem/tests/test_gaps.py +++ b/subiquity/common/filesystem/tests/test_gaps.py @@ -45,7 +45,7 @@ class TestSplitGap(unittest.TestCase): def test_too_big(self): [gap] = gaps.parts_and_gaps(make_disk()) - with self.assertRaises(Exception): + with self.assertRaises(ValueError): gap.split(gap.size + MiB) def test_split(self):