From 197a98a120c6bee849645e856b9563555bba939a Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 13 Aug 2021 17:07:34 +0000 Subject: [PATCH] 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 --- lodgeit/lib/json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodgeit/lib/json.py b/lodgeit/lib/json.py index 4fe31f3..b84f249 100644 --- a/lodgeit/lib/json.py +++ b/lodgeit/lib/json.py @@ -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')