Commit 50d1278e authored by Toby Dickenson's avatar Toby Dickenson

support for exceptions who raise an exception in str(). They get represented...

support for exceptions who raise an exception in str(). They get represented as <unprintable X object>
parent 3fb5c5be
...@@ -17,8 +17,8 @@ Aqueduct database adapters, etc. ...@@ -17,8 +17,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new This module can also be used as a simple template for implementing new
item types. item types.
$Id: SimpleItem.py,v 1.96 2002/04/04 16:24:32 shane Exp $''' $Id: SimpleItem.py,v 1.97 2002/04/05 16:01:55 htrd Exp $'''
__version__='$Revision: 1.96 $'[11:-2] __version__='$Revision: 1.97 $'[11:-2]
import re, sys, Globals, App.Management, Acquisition, App.Undo import re, sys, Globals, App.Management, Acquisition, App.Undo
import AccessControl.Role, AccessControl.Owned, App.Common import AccessControl.Role, AccessControl.Owned, App.Common
...@@ -210,7 +210,11 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, ...@@ -210,7 +210,11 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
except: except:
LOG('OFS', ERROR, 'Exception while rendering an error message', LOG('OFS', ERROR, 'Exception while rendering an error message',
error=sys.exc_info()) error=sys.exc_info())
v = str(error_value) + ( try:
strv = str(error_value)
except:
strv = '<unprintable %s object>' % str(type(error_value).__name__)
v = strv + (
" (Also, an error occurred while attempting " " (Also, an error occurred while attempting "
"to render the standard error message.)") "to render the standard error message.)")
raise error_type, v, tb raise error_type, v, tb
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Site error log module. """Site error log module.
$Id: SiteErrorLog.py,v 1.3 2002/04/04 16:25:43 shane Exp $ $Id: SiteErrorLog.py,v 1.4 2002/04/05 16:01:55 htrd Exp $
""" """
import os import os
...@@ -130,10 +130,15 @@ class SiteErrorLog (SimpleItem): ...@@ -130,10 +130,15 @@ class SiteErrorLog (SimpleItem):
except: except:
pass pass
try:
strv = str(info[1])
except:
strv = '<unprintable %s object>' % str(type(info[1]).__name__)
log = self._getLog() log = self._getLog()
log.append({ log.append({
'type': str(getattr(info[0], '__name__', info[0])), 'type': str(getattr(info[0], '__name__', info[0])),
'value': str(info[1]), 'value': strv,
'time': now, 'time': now,
'id': str(now) + str(random()), # Low chance of collision 'id': str(now) + str(random()), # Low chance of collision
'tb_text': tb_text, 'tb_text': tb_text,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment