Show the request that caused RPC errors in their messages

This commit is contained in:
Lonami Exo
2018-10-15 18:35:51 +02:00
parent ee4c952290
commit 99129daeee
4 changed files with 31 additions and 55 deletions

View File

@@ -26,14 +26,16 @@ def generate_errors(errors, f):
# Error classes generation
for error in errors:
f.write('\n\nclass {}({}):\n def __init__(self, **kwargs):\n'
f.write('\n\nclass {}({}):\n'
' def __init__(self, request, **kwargs):\n'
' '.format(error.name, error.subclass))
if error.has_captures:
f.write("self.{} = int(kwargs.get('capture', 0))\n "
.format(error.capture_name))
f.write('super(Exception, self).__init__({}'
f.write('super(Exception, self).__init__('
'{} + self._fmt_request(request)'
.format(repr(error.description)))
if error.has_captures: