app: raise a clear exception when request arguments fail to parse

This error is an indication that a JSON body was sent without the content type set to "application/json".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-03-05 15:10:53 -05:00
parent 4de33bae4a
commit 13ccdb4df1
1 changed files with 6 additions and 1 deletions

View File

@ -297,7 +297,12 @@ class DynamicRequestHandler(AuthorizedRequestHandler):
return {'objects': args} return {'objects': args}
def parse_args(self): def parse_args(self):
args = self._parse_query() try:
args = self._parse_query()
except Exception:
raise ServerError(
"Error Parsing Request Arguments. "
"Is the Content-Type correct?")
content_type = self.request.headers.get('Content-Type', "").strip() content_type = self.request.headers.get('Content-Type', "").strip()
if content_type.startswith("application/json"): if content_type.startswith("application/json"):
try: try: