From 05cd2175c3a633256b4b4e90ab09d63fc1db657c Mon Sep 17 00:00:00 2001 From: CofenseLabs-Doug Date: Fri, 29 Apr 2022 09:44:12 -0400 Subject: [PATCH] Show all errors' details The title attribute of errors often does not include the most helpful information (ex. 'must be unique') where details seems more helpful (ex. 'email address - must be unique'). Also, raise up ALL returned errors -- not just the first one. --- src/jsonapi_client/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jsonapi_client/common.py b/src/jsonapi_client/common.py index c97c318..30c7af4 100644 --- a/src/jsonapi_client/common.py +++ b/src/jsonapi_client/common.py @@ -99,7 +99,7 @@ def mark_invalid(self): def error_from_response(response_content): try: - error_str = response_content['errors'][0]['title'] + error_str = repr([ e['detail'] for e in response_content['errors'] ]) except Exception: error_str = '?' return error_str