mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 12:15:05 +01:00
Get proper unicode printouts from the unhandled exception handler
This commit is contained in:
parent
e7e78da5c1
commit
1b1d51b078
1 changed files with 4 additions and 5 deletions
|
|
@ -10,8 +10,8 @@
|
|||
QObject)
|
||||
from calibre.utils.config import OptionParser
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre import prints, force_unicode, as_unicode
|
||||
from polyglot.io import PolyglotBytesIO
|
||||
from calibre import prints, as_unicode
|
||||
from polyglot.io import PolyglotStringIO
|
||||
|
||||
|
||||
def option_parser(usage='''\
|
||||
|
|
@ -134,7 +134,7 @@ def unhandled_exception(self, exc_type, value, tb):
|
|||
return
|
||||
import traceback
|
||||
try:
|
||||
sio = PolyglotBytesIO(errors='replace')
|
||||
sio = PolyglotStringIO(errors='replace')
|
||||
try:
|
||||
from calibre.debug import print_basic_debug_info
|
||||
print_basic_debug_info(out=sio)
|
||||
|
|
@ -144,11 +144,10 @@ def unhandled_exception(self, exc_type, value, tb):
|
|||
if getattr(value, 'locking_debug_msg', None):
|
||||
prints(value.locking_debug_msg, file=sio)
|
||||
fe = sio.getvalue()
|
||||
prints(fe, file=sys.stderr)
|
||||
fe = force_unicode(fe)
|
||||
msg = '<b>%s</b>:'%exc_type.__name__ + as_unicode(value)
|
||||
error_dialog(self, _('Unhandled exception'), msg, det_msg=fe,
|
||||
show=True)
|
||||
prints(fe, file=sys.stderr)
|
||||
except BaseException:
|
||||
pass
|
||||
except:
|
||||
|
|
|
|||
Loading…
Reference in a new issue