Raise exception instead of using assert

This commit is contained in:
shortcutme 2019-07-03 18:35:55 +02:00
parent 80bfccd9d3
commit ff32f822ba
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
7 changed files with 27 additions and 12 deletions

View file

@ -13,7 +13,8 @@ class WsLogStreamer(logging.StreamHandler):
self.ui_websocket = ui_websocket
if filter:
assert SafeRe.isSafePattern(filter)
if not SafeRe.isSafePattern(filter):
raise Exception("Not a safe prex pattern")
self.filter_re = re.compile(".*" + filter)
else:
self.filter_re = None