mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-30 08:44:01 +08:00
MAINT: Raise LookupError instead of KeyError.
KeyError calls __repr__ on its input, which makes it really unpleasant to read multi-line strings.
This commit is contained in:
@@ -118,9 +118,7 @@ def find_in_sorted_index(dts, dt):
|
||||
"""
|
||||
ix = dts.searchsorted(dt)
|
||||
if dts[ix] != dt:
|
||||
raise KeyError(
|
||||
"{0} is not in calendar [{1} ... {2}]".format(dt, dts[0], dts[-1])
|
||||
)
|
||||
raise LookupError("{dt} is not in {dts}".format(dt=dt, dts=dts))
|
||||
return ix
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user