Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
23.3.0
======

- Modify the ``afterfail_error_message`` to skip error logging
if the Zope request will be retried (by Zope automatically)

23.2.0
======

Expand Down
9 changes: 6 additions & 3 deletions Products/PerFactErrors/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import zExceptions.ExceptionFormatter
from zExceptions import Unauthorized
from zope.pagetemplate.pagetemplate import PTRuntimeError
from transaction.interfaces import TransientError

try:
from ZPublisher.HTTPRequest import WSGIRequest
Expand All @@ -26,11 +27,13 @@ def afterfail_error_message(event):
"""
req = event.request
context = req['PARENTS'][0]
render = getattr(context, 'afterfail_error_message_', None)
if render is None:
return
try:
error_type, error_value, error_tb = event.exc_info
render = getattr(context, 'afterfail_error_message_', None)
retry = isinstance(error_value, TransientError) and req.supports_retry()
if render is None or retry:
return

# With WSGI, the error traceback itself no longer is printed to the
# event.log, so we do that manually - except for special cases
log_error = (
Expand Down