Skip to content

Instantly share code, notes, and snippets.

View cemsbr's full-sized avatar

Carlos Eduardo Moreira dos Santos cemsbr

  • São Paulo, Brazil
View GitHub Profile
@cemsbr
cemsbr / multiple_exceptions.py
Created June 15, 2016 17:16
Throw multiple validation errors
# based on http://stackoverflow.com/questions/6470428/catch-multiple-exceptions-in-one-line-except-block
class ValidationError(Exception):
pass
class ValidationErrors(ValidationError):
def __str__(self):
return ' '.join(str(e) for e in self.args[0])