Download this file

exception.py    34 lines (28 with data), 1.1 kB

 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
from __future__ import print_function
'''
qobuz.exception
~~~~~~~~~~~~~~~
:part_of: xbmc-qobuz
:copyright: (c) 2012 by Joachim Basmaison, Cyril Leclerc
:license: GPLv3, see LICENSE for more details.
'''
import sys
import pprint
import traceback
class QobuzXbmcError(Exception):
def __init__(self, **ka):
if not 'additional' in ka or ka['additional'] is None:
ka['additional'] = ''
if (not 'who' in ka) or (not 'what' in ka):
raise Exception(
'QobuzXbmcError', 'Missing constructor arguments (who|what)')
nl = "\n"
msg = "[QobuzXbmcError]" + nl
msg += " - who : " + pprint.pformat(ka['who']) + nl
msg += " - what : " + ka['what'] + nl
msg += " - additional : " + repr(ka['additional']) + nl
# msg += " - type : " + self.exc_type + nl
# msg += " - value : " + self.exc_value + nl
msg += " - Stack : " + nl
print("%s" % msg, file=sys.stderr)
print("%s" % traceback.print_exc(10), file=sys.stderr)