core: minor error handling tweaks
This commit is contained in:
parent
2a2478bfa9
commit
831fee42a1
3 changed files with 13 additions and 8 deletions
|
@ -110,11 +110,13 @@ def test_sort_res_by() -> None:
|
|||
|
||||
# todo proper typevar?
|
||||
from datetime import datetime
|
||||
def set_error_datetime(e: Exception, dt: datetime) -> None:
|
||||
def set_error_datetime(e: Exception, dt: Optional[datetime]) -> None:
|
||||
if dt is None:
|
||||
return
|
||||
e.args = e.args + (dt,)
|
||||
# todo not sure if should return new exception?
|
||||
|
||||
def attach_dt(e: Exception, *, dt: datetime) -> Exception:
|
||||
def attach_dt(e: Exception, *, dt: Optional[datetime]) -> Exception:
|
||||
set_error_datetime(e, dt)
|
||||
return e
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue