Docs: clarify the handling of exceptions raised in errbacks (#7898)

This commit is contained in:
Adrian 2026-08-09 13:53:33 +02:00 committed by GitHub
parent 63d5ce6272
commit 7c797968a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -770,6 +770,10 @@ is raise while processing it.
It receives a :exc:`~twisted.python.failure.Failure` as first parameter and can
be used to track connection establishment timeouts, DNS errors etc.
If an errback raises an exception, Scrapy logs it and sends the
:signal:`spider_error` signal, unless the exception is the one that the errback
received, which Scrapy logs as a download error instead.
Here's an example spider logging all errors and catching some specific
errors if needed:

View File

@ -145,8 +145,9 @@ one or more of these methods:
.. method:: process_spider_exception(response, exception)
This method is called when a spider or :meth:`process_spider_output`
method (from a previous spider middleware) raises an exception.
This method is called when a spider callback or a
:meth:`process_spider_output` method (from a previous spider
middleware) raises an exception.
:meth:`process_spider_exception` should return either ``None`` or an
iterable of :class:`~scrapy.Request` or :ref:`item <topics-items>`