Skip to content

Commit

Permalink
Implement support for improved error handling behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Nov 4, 2015
1 parent 1eba8ee commit 4b89be9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hug/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ def interface(request, response, api_version=None, **kwargs):
except InvalidTypeData as error:
errors[key] = error.reasons or str(error.message)
except Exception as error:
errors[key] = str(error)
if hasattr(error, 'args') and error.args:
errors[key] = error.args[0]
else:
errors[key] = str(error)

if 'request' in accepted_parameters:
input_parameters['request'] = request
Expand Down

0 comments on commit 4b89be9

Please sign in to comment.