@@ -242,8 +242,7 @@ def lookup(code: int) -> str:
242242 50028 : "Invalid role" ,
243243 50033 : "Invalid Recipient(s)" ,
244244 50034 : "A message provided was too old to bulk delete" ,
245- 50035 : "Invalid form body (returned for both application/json and multipart/form-data bodies),"
246- " or invalid Content-Type provided" ,
245+ 50035 : "Invalid form body or invalid Content-Type provided" ,
247246 50036 : "An invite was accepted to a guild the application's bot is not in" ,
248247 50041 : "Invalid API version provided" ,
249248 50045 : "File uploaded exceeds the maximum size" ,
@@ -310,12 +309,29 @@ def __init__(self, code: int = 0, message: str = None, severity: int = 0, **kwar
310309 self .log (self .message )
311310
312311 if _fmt_error :
312+
313+ _flag : bool = (
314+ self .message .lower () in self .lookup (self .code ).lower ()
315+ ) # creativity is hard
316+
317+ _fmt = "\n " .join (
318+ [
319+ f"Error at { e [2 ]} : { e [0 ]} - { e [1 ] if e [1 ].endswith ('.' ) else f'{ e [1 ]} .' } "
320+ for e in _fmt_error
321+ ]
322+ )
323+
313324 super ().__init__ (
314- f"{ self .message } (code: { self .code } , severity { self .severity } )\n "
315- + "\n " .join ([f"Error at { e [2 ]} : { e [0 ]} - { e [1 ]} " for e in _fmt_error ])
325+ "\n "
326+ f" Error { self .code } | { self .message if _flag else self .lookup (self .code )} \n "
327+ f" { _fmt if _flag else self .message } \n "
328+ f" { f'Severity { self .severity } .' if _flag else _fmt } \n "
329+ f" { '' if _flag else f'Severity { self .severity } .' } "
316330 )
317331 else :
318332 super ().__init__ (
319- f"An error occurred:\n "
320- f"{ self .message } , with code '{ self .code } ' and severity '{ self .severity } '"
333+ "\n "
334+ f" Error { self .code } | { self .lookup (self .code )} :\n "
335+ f" { self .message } { '' if self .message .endswith ('.' ) else '.' } \n "
336+ f" Severity { self .severity } ."
321337 )
0 commit comments