error handling

This commit is contained in:
ed 2019-07-11 16:54:13 +00:00
parent 051c782c28
commit 456fab2e0b
3 changed files with 13 additions and 7 deletions

View file

@ -642,7 +642,11 @@ class HttpCli(object):
href = "/" + vpath + "/" + fn
fspath = fsroot + "/" + fn
inf = os.stat(fsenc(fspath))
try:
inf = os.stat(fsenc(fspath))
except FileNotFoundError as ex:
self.log("broken symlink: {}".format(fspath))
continue
is_dir = stat.S_ISDIR(inf.st_mode)
if is_dir:

View file

@ -183,7 +183,7 @@ class MultipartParser(object):
buf = self.sr.recv(bufsz)
if not buf:
# abort: client disconnected
raise Pebkac(400, "client disconnected during post")
raise Pebkac(400, "client disconnected during multipart post")
while True:
ofs = buf.find(self.boundary)
@ -217,7 +217,7 @@ class MultipartParser(object):
buf2 = self.sr.recv(bufsz)
if not buf2:
# abort: client disconnected
raise Pebkac(400, "client disconnected during post")
raise Pebkac(400, "client disconnected during multipart post")
buf += buf2
@ -397,6 +397,9 @@ def read_socket(sr, total_size):
bufsz = remains
buf = sr.recv(bufsz)
if not buf:
raise Pebkac(400, "client disconnected during binary post")
remains -= len(buf)
yield buf

View file

@ -1,3 +1,6 @@
* {
line-height: 1.2em;
}
html,body,tr,th,td,#files,a {
color: inherit;
background: none;
@ -11,7 +14,6 @@ html {
background: #333;
font-family: sans-serif;
text-shadow: 1px 1px 0px #000;
line-height: 1.3em;
}
html, body {
margin: 0;
@ -23,7 +25,6 @@ body {
#path,
#path * {
font-size: 1em;
line-height: 1em;
}
#path {
color: #aca;
@ -168,7 +169,6 @@ a.play.act {
text-align: center;
background: #444;
border-radius: 2em;
line-height: 1em;
}
#widget {
position: fixed;
@ -246,7 +246,6 @@ a.play.act {
font-size: 1.25em;
width: 1.3em;
height: 1.2em;
line-height: 1em;
text-align: center;
margin-right: .5em;
border-radius: .3em;