Merge "Add info to RequestEntityTooLarge exception."

This commit is contained in:
Jenkins authored and Gerrit Code Review committed 2017-06-26 14:40:01 +00:00
commit e228d9eff9
1 file changed
+6 -1
+6 -1
View File
@@ -200,7 +200,12 @@ class LimitingReader(object):
self.sha1.update(res)
self.sha256.update(res)
if self.bytes_read > self.limit:
raise exception.RequestEntityTooLarge()
message = (_("The server is refusing to process a request because"
" the request entity with size of %(blob_length)s"
" bytes, is larger than the server is willing or able"
" to process - %(limit)s bytes.") %
{"blob_length": len_result, "limit": self.limit})
raise exception.RequestEntityTooLarge(message=message)
return res