Browse Source

Add FileParseException

pull/1310/head
Hironsan 3 years ago
parent
commit
8aeb06d503
1 changed files with 16 additions and 0 deletions
  1. 16
      app/api/views/upload/exception.py

16
app/api/views/upload/exception.py

@ -0,0 +1,16 @@
class FileParseException(Exception):
def __init__(self, filename: str, line_num: int, message: str):
self.filename = filename
self.line_num = line_num
self.message = message
def __str__(self):
return f'ParseError: You cannot parse line {self.line_num} in {self.filename}: {self.message}'
def dict(self):
return {
'filename': self.filename,
'line': self.line_num,
'message': self.message
}
Loading…
Cancel
Save