Raise exception when a stylesheet is unparsable.
This commit is contained in:
parent
743c3b1e26
commit
0400945ac4
@ -133,6 +133,11 @@ sessions = logging.getLogger('sessions')
|
||||
ram_handler = None
|
||||
|
||||
|
||||
class CriticalQtWarning(Exception):
|
||||
|
||||
"""Exception raised when there's a critical Qt warning."""
|
||||
|
||||
|
||||
def init_log(args):
|
||||
"""Init loggers based on the argparse namespace passed."""
|
||||
level = 'VDEBUG' if args.debug else args.loglevel.upper()
|
||||
@ -301,7 +306,17 @@ def qt_message_handler(msg_type, context, msg):
|
||||
'with: -9805', # noqa
|
||||
]
|
||||
|
||||
if any(msg.strip().startswith(pattern) for pattern in suppressed_msgs):
|
||||
# Messages which will trigger an exception immediately
|
||||
critical_msgs = [
|
||||
'Could not parse stylesheet of object',
|
||||
]
|
||||
|
||||
if any(msg.strip().startswith(pattern) for pattern in critical_msgs):
|
||||
# For some reason, the stack gets lost when raising here...
|
||||
logger = logging.getLogger('misc')
|
||||
logger.error("Got critical Qt warning!", stack_info=True)
|
||||
raise CriticalQtWarning(msg)
|
||||
elif any(msg.strip().startswith(pattern) for pattern in suppressed_msgs):
|
||||
level = logging.DEBUG
|
||||
else:
|
||||
level = qt_to_logging[msg_type]
|
||||
|
Loading…
Reference in New Issue
Block a user