Commit 56464b02 authored by Ziirish's avatar Ziirish

better exceptions handling

parent 15bb9eed
Pipeline #1596 passed with stages
in 18 minutes and 6 seconds
......@@ -161,7 +161,7 @@ def websocket(bind, port, debug):
def create_user(backend, password, ask, verbose, name):
"""Create a new user."""
try:
msg = app.load_modules(True)
msg = app.load_modules()
except Exception as e:
msg = str(e)
......@@ -346,7 +346,7 @@ def setup_burp(bconfcli, bconfsrv, client, host, redis, database,
app.config['BACKEND'] = backend
try:
msg = app.load_modules(True)
msg = app.load_modules()
except Exception as e:
msg = str(e)
......@@ -843,7 +843,7 @@ def diag(client, host, tips):
sys.exit(1)
try:
msg = app.load_modules(True)
msg = app.load_modules()
except Exception as e:
msg = str(e)
......@@ -1127,7 +1127,7 @@ def sysinfo(verbose, load):
msg = None
if load:
try:
msg = app.load_modules(True)
msg = app.load_modules()
except Exception as e:
msg = str(e)
......
......@@ -447,14 +447,15 @@ class BUIServer(Flask):
self.client = mod.Burp(self, conf=self.conf)
except Exception as exc:
msg = 'Failed loading backend {0}: {1}'.format(
self.backend,
module,
str(exc)
)
if strict:
self.logger.critical(msg, exc_info=exc, stack_info=True)
sys.exit(2)
else:
raise Exception(msg)
exc.args = (msg,)
raise exc
self.audit.logger.info('Burp-UI server started')
......
......@@ -148,7 +148,7 @@ class Parallel:
if not newbuf:
# 3 successive read failure => raise exception
if tries > 3:
raise Exception('Unable to read full response')
raise IOError('Unable to read full response')
tries += 1
trio.sleep(0.1)
continue
......@@ -268,7 +268,7 @@ class Burp(Burp2):
async_client = Parallel(self.conf)
try:
return await async_client.status(query, timeout, cache)
except OSError as exc:
except (OSError, IOError) as exc:
raise BUIserverException(str(exc))
if not self._ready:
self.init_all()
......@@ -277,7 +277,7 @@ class Burp(Burp2):
async_client = Parallel(self.conf)
try:
return await async_client.request(func, *args, **kwargs)
except OSError as exc:
except (OSError, IOError) as exc:
raise BUIserverException(str(exc))
if not self._ready:
self.init_all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment