From c378727dcf10f883f7fe07ed697ed26b2567da48 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Wed, 21 Sep 2022 12:22:52 +0300 Subject: [PATCH] Save exception --- check_link/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check_link/base.py b/check_link/base.py index efcf43b..547e64f 100644 --- a/check_link/base.py +++ b/check_link/base.py @@ -60,6 +60,7 @@ class Link: code: Optional[int] = None details: str = "Link is not checked yet" delay: float = 0 + exc: Optional[Exception] = None def __post_init__(self): url = urlparse(self.link) @@ -77,6 +78,8 @@ def state_from_code( self.reason = reason def state_from_exception(self, err: Exception): + self.exc = err + if isinstance(err, TimeoutError): self.state = State.timeout else: