Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Full typing for scrapy/logformatter.py.

Andrey Rakhmatullin9960c62b871a
diff --git a/scrapy/core/scraper.py b/scrapy/core/scraper.py
index a85f6a661..a54929712 100644
--- a/scrapy/core/scraper.py
+++ b/scrapy/core/scraper.py
@@ -364,6 +364,7 @@ class Scraper:
spider=spider,
exception=output.value,
)
+ assert ex
logkws = self.logformatter.item_error(item, ex, response, spider)
logger.log(
*logformatter_adapter(logkws),
diff --git a/scrapy/logformatter.py b/scrapy/logformatter.py
index 600da0d40..9b05e1153 100644
--- a/scrapy/logformatter.py
+++ b/scrapy/logformatter.py
@@ -114,7 +114,7 @@ class LogFormatter:
}
def item_error(
- self, item: Any, exception, response: Response, spider: Spider
+ self, item: Any, exception: BaseException, response: Response, spider: Spider
) -> dict:
"""Logs a message when an item causes an error while it is passing
through the item pipeline.