Project

General

Profile

« Previous | Next » 

Revision 5576

sql.py: Added EncodingException and parse it in run_query()

View differences:

lib/sql.py
72 72
        self.type = type_
73 73
        self.col = col
74 74

  
75
class EncodingException(ExceptionWithName): pass
76

  
75 77
class DuplicateKeyException(ConstraintException): pass
76 78

  
77 79
class NullValueException(ConstraintException): pass
......
517 519
            msg = strings.ustr(e.args[0])
518 520
            msg = re.sub(r'^(?:PL/Python: )?ValueError: ', r'', msg)
519 521
            
522
            match = re.match(r'^invalid byte sequence for encoding "(.+?)":',
523
                msg)
524
            if match:
525
                encoding, = match.groups()
526
                raise EncodingException(encoding, e)
527
            
520 528
            match = re.match(r'^duplicate key value violates unique constraint '
521 529
                r'"(.+?)"', msg)
522 530
            if match:

Also available in: Unified diff