mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
better errors through broker
This commit is contained in:
parent
f955d2bd58
commit
e565ad5f55
|
@ -28,7 +28,7 @@ class ExceptionalQueue(Queue, object):
|
|||
if rv[1] == "pebkac":
|
||||
raise Pebkac(*rv[2:])
|
||||
else:
|
||||
raise Exception(rv[2])
|
||||
raise rv[2]
|
||||
|
||||
return rv
|
||||
|
||||
|
@ -65,8 +65,8 @@ def try_exec(want_retval: Union[bool, int], func: Any, *args: list[Any]) -> Any:
|
|||
|
||||
return ["exception", "pebkac", ex.code, str(ex)]
|
||||
|
||||
except:
|
||||
except Exception as ex:
|
||||
if not want_retval:
|
||||
raise
|
||||
|
||||
return ["exception", "stack", traceback.format_exc()]
|
||||
return ["exception", "stack", ex]
|
||||
|
|
|
@ -646,11 +646,8 @@ class HttpCli(object):
|
|||
if not self._check_nonfatal(pex, post):
|
||||
self.keepalive = False
|
||||
|
||||
if pex is ex:
|
||||
em = msg = str(ex)
|
||||
else:
|
||||
em = repr(ex)
|
||||
msg = min_ex()
|
||||
em = str(ex)
|
||||
msg = em if pex is ex else min_ex()
|
||||
|
||||
if pex.code != 404 or self.do_log:
|
||||
self.log(
|
||||
|
|
|
@ -1377,7 +1377,7 @@ def vol_san(vols: list["VFS"], txt: bytes) -> bytes:
|
|||
def min_ex(max_lines: int = 8, reverse: bool = False) -> str:
|
||||
et, ev, tb = sys.exc_info()
|
||||
stb = traceback.extract_tb(tb) if tb else traceback.extract_stack()[:-1]
|
||||
fmt = "%s @ %d <%s>: %s"
|
||||
fmt = "%s:%d <%s>: %s"
|
||||
ex = [fmt % (fp.split(os.sep)[-1], ln, fun, txt) for fp, ln, fun, txt in stb]
|
||||
if et or ev or tb:
|
||||
ex.append("[%s] %s" % (et.__name__ if et else "(anonymous)", ev))
|
||||
|
|
Loading…
Reference in a new issue