Properly handle paste exceptions

With Python 3, it doesn't work to decode type str. The str() recast
is still necessary however, since the exception data type is not
directly serializable in this way.

Change-Id: I3925cbb0d0ff594407c7b93b0d982f2cad386ad6
This commit is contained in:
Jeremy Stanley 2021-08-13 17:07:34 +00:00
parent 8057480ced
commit 197a98a120

View File

@ -42,6 +42,6 @@ class JSONRequestHandler(object):
'error': None
}
except Exception as e:
response = {'data': None, 'error': str(e).decode('utf-8')}
response = {'data': None, 'error': str(e)}
body = dumps(response, indent=local.request.is_xhr and 2 or 0)
return Response(body + '\n', mimetype='application/json')