Include user input in unit parsing error messages
This commit is contained in:
parent
694f3a3f96
commit
1d29c6cce8
@ -200,7 +200,7 @@ class Cable:
|
|||||||
try:
|
try:
|
||||||
g, u = self.gauge.split(' ')
|
g, u = self.gauge.split(' ')
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception('Gauge must be a number, or number and unit separated by a space')
|
raise Exception(f'{self.gauge} - Gauge must be a number, or number and unit separated by a space')
|
||||||
self.gauge = g
|
self.gauge = g
|
||||||
|
|
||||||
if u.upper() == 'AWG':
|
if u.upper() == 'AWG':
|
||||||
@ -219,7 +219,7 @@ class Cable:
|
|||||||
l, u = self.length.split(' ')
|
l, u = self.length.split(' ')
|
||||||
l = float(l)
|
l = float(l)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception('Length must be a number, or number and unit separated by a space')
|
raise Exception(f'{self.length} - Length must be a number, or number and unit separated by a space')
|
||||||
self.length = l
|
self.length = l
|
||||||
self.length_unit = u
|
self.length_unit = u
|
||||||
elif self.length is not None: # length specified, assume m
|
elif self.length is not None: # length specified, assume m
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user