exceptions.py
956 Bytes
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
'''
Created on Feb 19, 2014
@author: lennyn
'''
class FSABuilderException(Exception):
'''
Exception in configFile module
'''
def __init__(self, msg):
self.msg = msg
def __str__(self):
return 'Failed to create Morfeusz files: ' + self.msg
def validate(predicate, msg):
if not predicate:
raise FSABuilderException(msg)
class SegtypesException(FSABuilderException):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return u'Error in segment rules: %s' % self.msg
class ConfigFileException(FSABuilderException):
def __init__(self, filename, lineNum, msg):
self.filename = filename
self.lineNum = lineNum
self.msg = msg
def __str__(self):
if self.lineNum:
return u'%s:%d - %s' % (self.filename, self.lineNum, self.msg)
else:
return u'%s - %s' % (self.filename, self.msg)