forked from hakyimlab/QTL_to_PredictDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptions.py
44 lines (33 loc) · 1.62 KB
/
Exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class ReportableException(Exception):
"""Simple exeception with message"""
def __init__(self, msg):
self.msg = msg
class InvalidArguments(Exception):
"""Logical Error for unexpected arguments"""
def __init__(self, msg):
super(InvalidArguments, self).__init__("Invalid arguments: %s" % (msg))
class InvalidInputFormat(ReportableException):
"""Error associated with input format"""
def __init__(self, msg):
super(InvalidInputFormat, self).__init__("Invalid input format: %s" % (msg))
class InvalidOutputFormat(ReportableException):
"""Error associated with input format"""
def __init__(self, msg):
super(InvalidOutputFormat, self).__init__("Invalid output format: %s" % (msg))
class MalformedInputFile(ReportableException):
"""Errors associated with a problematic input file"""
def __init__(self, filename, msg):
super(MalformedInputFile, self).__init__("While processing file, %s: %s" % (filename, msg) )
class BadFilename(ReportableException):
"""Reports invalid filename"""
def __init__(self, filename):
super(BadFilename, self).__init__("Invalid filename: %s" % (filename))
class BadDirectory(ReportableException):
"""Reports non-existnant directory"""
def __init__(self, dir):
super(BadDirectory, self).__init__("Invalid directory: %s" % (dir))
class InvalidDbFormat(ReportableException):
"""Report invalid table names, missing columns, etc"""
def __init__(self, filename, msg):
errorMsg = "DB Error encounted loading data from %s\n\t'%s'" % (filename, msg)
super(InvalidDbFormat, self).__init__(errorMsg)