Project

General

Profile

« Previous | Next » 

Revision 2239

sql.py: run_query(): Parse "invalid input value at assignment" errors as FunctionValueExceptions

View differences:

lib/sql.py
50 50

  
51 51
class NullValueException(ExceptionWithColumns): pass
52 52

  
53
class FunctionValueException(ExceptionWithName): pass
54

  
53 55
class DuplicateTableException(ExceptionWithName): pass
54 56

  
55 57
class DuplicateFunctionException(ExceptionWithName): pass
......
352 354
            except NotImplementedError: raise e
353 355
            else: raise DuplicateKeyException(cols, e)
354 356
        match = re.search(r'null value in column "(\w+)" violates not-null '
355
            'constraint', msg)
357
            r'constraint', msg)
356 358
        if match: raise NullValueException([match.group(1)], e)
359
        match = re.search(r'invalid input value\b.*\n'
360
            r'CONTEXT:.*\bfunction "(\w+)".*\bat assignment', msg)
361
        if match: raise FunctionValueException(match.group(1), e)
357 362
        match = re.search(r'relation "(\w+)" already exists', msg)
358 363
        if match: raise DuplicateTableException(match.group(1), e)
359 364
        match = re.search(r'function "(\w+)" already exists', msg)

Also available in: Unified diff