/usr/lib/python3/dist-packages/Onboard/Exceptions.py is in onboard 1.0.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from traceback import format_tb
import sys
from Onboard.utils import unicode_str
class ChainableError(Exception):
"""
Base class for Onboard errors
We want Python to print the stacktrace of the first exception in the chain
so we store the last stacktrace if the previous exception in the chain
has not.
"""
_last_exception = None
def __init__(self, message, chained_exception = None):
self._message = message
self.chained_exception = chained_exception
if chained_exception:
if not (isinstance(chained_exception, ChainableError) \
and chained_exception.traceback):
# Store last traceback
self._last_exception = sys.exc_info()
def _get_traceback(self):
if self._last_exception:
return self._last_exception[2]
elif self.chained_exception \
and isinstance(self.chained_exception, ChainableError):
return self.chained_exception.traceback
else:
return None
traceback = property(_get_traceback)
def __str__(self):
message = unicode_str(self._message)
if self.chained_exception:
message += ", " + unicode_str(self.chained_exception)
return message
class SVGSyntaxError(ChainableError):
"""Error raised when Onboard can't comprehend SVG layout file."""
pass
class LayoutFileError(ChainableError):
"""Error raised when Onboard can't comprehend layout definition file."""
pass
class ThemeFileError(ChainableError):
"""Error raised when Onboard can't comprehend theme definition file."""
pass
class ColorSchemeFileError(ChainableError):
"""Error raised when Onboard can't comprehend color
scheme definition file."""
pass
class SchemaError(ChainableError):
"""Error raised when a gesettings schema does not exist """
pass
def chain_handler(type, value, traceback):
"""
Wrap the default handler so that we can get the traceback from chained
exceptions.
"""
if isinstance(value, ChainableError) and value.traceback:
traceback = value.traceback
sys.__excepthook__(type, value, traceback)
|