##// END OF EJS Templates
wireprotoserver: convert ErrorResponse to bytes...
Matt Harbison -
r47524:71443f74 stable
parent child Browse files
Show More
@@ -24,6 +24,7 b' from .interfaces import util as interfac'
24 from .utils import (
24 from .utils import (
25 cborutil,
25 cborutil,
26 compression,
26 compression,
27 stringutil,
27 )
28 )
28
29
29 stringio = util.stringio
30 stringio = util.stringio
@@ -233,10 +234,12 b' def handlewsgirequest(rctx, req, res, ch'
233 except hgwebcommon.ErrorResponse as e:
234 except hgwebcommon.ErrorResponse as e:
234 for k, v in e.headers:
235 for k, v in e.headers:
235 res.headers[k] = v
236 res.headers[k] = v
236 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
237 res.status = hgwebcommon.statusmessage(
238 e.code, stringutil.forcebytestr(e)
239 )
237 # TODO This response body assumes the failed command was
240 # TODO This response body assumes the failed command was
238 # "unbundle." That assumption is not always valid.
241 # "unbundle." That assumption is not always valid.
239 res.setbodybytes(b'0\n%s\n' % pycompat.bytestr(e))
242 res.setbodybytes(b'0\n%s\n' % stringutil.forcebytestr(e))
240
243
241 return True
244 return True
242
245
@@ -88,7 +88,9 b' def handlehttpv2request(rctx, req, res, '
88 try:
88 try:
89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
90 except hgwebcommon.ErrorResponse as e:
90 except hgwebcommon.ErrorResponse as e:
91 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
91 res.status = hgwebcommon.statusmessage(
92 e.code, stringutil.forcebytestr(e)
93 )
92 for k, v in e.headers:
94 for k, v in e.headers:
93 res.headers[k] = v
95 res.headers[k] = v
94 res.setbodybytes(b'permission denied')
96 res.setbodybytes(b'permission denied')
General Comments 0
You need to be logged in to leave comments. Login now