Skip to content

Commit c24925e

Browse files
committed
Fix issue2550826 third try. This limits the capture of exceptions to
Environment (includes the original IOError) and Arithmetic errors. It repackages these errors as detector exceptions so they can be reported. This allows the detectors to raise Reject and other exceptions and propagate them up from the detectors.
1 parent f8b3a7d commit c24925e

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Fixed:
9999
- issue2550907 Fix errors when creating documentation. Work done by
100100
Peter Funk (pefu). (Applied by John Rouillard with small change
101101
omitting obsolete security.txt.)
102-
- issue2550826 Capture all exceptions from auditors/reactors and
102+
- issue2550826 Capture some exceptions from auditors/reactors and
103103
raise a DetectorError instead. This allows failures like IOErrors
104104
from the detectors (e.g. unable to access files) to be handled.
105105
Previously an IOError just resulted in no output (premature end of

roundup/hyperdb.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@
3030
from roundup.i18n import _
3131
from roundup.cgi.exceptions import DetectorError
3232

33-
# import other errors that a detector is allowed to throw
34-
# so they can be raised and not captured by the DetectorError
35-
from roundup.exceptions import Reject, RejectRaw
36-
try:
37-
from pytz import UnknownTimeZoneError
38-
except:
39-
UnknownTimeZoneError = ValueError
40-
4133
#
4234
# Types
4335
#
@@ -1302,11 +1294,7 @@ def fireAuditors(self, event, nodeid, newvalues):
13021294
for prio, name, audit in self.auditors[event]:
13031295
try:
13041296
audit(self.db, self, nodeid, newvalues)
1305-
except (Reject, RejectRaw, ValueError, UnknownTimeZoneError):
1306-
# these are raised by detectors to cause actions
1307-
# to occur at other levels. Reassert them.
1308-
raise
1309-
except Exception as e:
1297+
except (EnvironmentError, ArithmeticError) as e:
13101298
tb = traceback.format_exc()
13111299
html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>').
13121300
replace(' ', '&nbsp;'))
@@ -1324,11 +1312,7 @@ def fireReactors(self, event, nodeid, oldvalues):
13241312
for prio, name, react in self.reactors[event]:
13251313
try:
13261314
react(self.db, self, nodeid, oldvalues)
1327-
except (Reject, RejectRaw, ValueError):
1328-
# these are raised by detectors to cause actions
1329-
# to occur at other levels. Reassert them.
1330-
raise
1331-
except Exception as e:
1315+
except (EnvironmentError, ArithmeticError) as e:
13321316
tb = traceback.format_exc()
13331317
html = ("<h1>Traceback</h1>" + str(tb).replace('\n', '<br>').
13341318
replace(' ', '&nbsp;'))

0 commit comments

Comments
 (0)