exceptions.py 1.35 KB
Newer Older
1
2
from __future__ import absolute_import
from __future__ import division
3
from __future__ import print_function
4
5
from __future__ import unicode_literals

6
7
8
import pykat.external.six as six
if six.PY2:
	import exceptions
9
import os
Daniel Brown's avatar
Daniel Brown committed
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

class BasePyKatException(Exception):
    def __init__(self, msg):
        self.__msg = msg
        
    def __str__(self):
        return self.__msg

class FinesseParse(BasePyKatException) :    
    def __init__(self, msg):
        BasePyKatException.__init__(self, "Error parsing Finesse input\n{0}".format(msg))
    
class MissingFinesseEnvVar(BasePyKatException) :    
    def __init__(self):
        BasePyKatException.__init__(self, "The environment variable FINESSE_DIR was not defined")

class MissingFinesse(BasePyKatException) :    
    def __init__(self):
        BasePyKatException.__init__(self, "Could not find the finesse executable 'kat' in '{0}'," \
                                     "or you do not have the permissions to run it." \
                                      .format(os.environ.get('FINESSE_DIR')))
    
class FinesseRunError(BasePyKatException) :
    def __init__(self, err, kat):
        self.__err = err
        self.__kat = kat
        
37
38
        BasePyKatException.__init__(self, "Finesse error (file {1}):\n{0}".format(self.__err, self.__kat))
        #BasePyKatException.__init__(self, "{0}".format(self.__err))
Daniel Brown's avatar
Daniel Brown committed
39