Project

General

Profile

« Previous | Next » 

Revision 2345

sql.py: ConstraintException, NullValueException: Improved error messages

View differences:

sql.py
48 48

  
49 49
class ConstraintException(DbException):
50 50
    def __init__(self, name, cols, cause=None):
51
        DbException.__init__(self, 'Violated constraint '+name+ ' on columns: '
51
        DbException.__init__(self, 'Violated '+name+ ' constraint on columns: '
52 52
            +(', '.join(cols)), cause)
53 53
        self.name = name
54 54
        self.cols = cols
......
364 364
        
365 365
        match = re.search(r'null value in column "(\w+)" violates not-null '
366 366
            r'constraint', msg)
367
        if match: raise NullValueException('', [match.group(1)], e)
367
        if match: raise NullValueException('NOT NULL', [match.group(1)], e)
368 368
        
369 369
        match = re.search(r'invalid input (?:syntax|value)\b.*: "(.+)"\n'
370 370
            r'(?:(?s).*)\bfunction "(\w+)".*\bat assignment', msg)

Also available in: Unified diff