Simpler definition of a custom exception class

This commit is contained in:
Gilles Peskine 2020-01-22 15:55:36 +01:00
parent 8c4a84c5de
commit 566407d6f6

View file

@ -28,11 +28,9 @@ import sys
class InputFormatError(Exception):
def __init__(self, filename, line_number, message, *args, **kwargs):
self.filename = filename
self.line_number = line_number
self.message = message.format(*args, **kwargs)
def __str__(self):
return '{}:{}: {}'.format(self.filename, self.line_number, self.message)
message = '{}:{}: {}'.format(filename, line_number,
message.format(*args, **kwargs))
super().__init__(message)
STANDARD_SECTIONS = (
b'Interface changes',