Revision 2247
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
42 | 42 |
class ExceptionWithNameValue(DbException): |
43 | 43 |
def __init__(self, name, value, cause=None): |
44 | 44 |
DbException.__init__(self, |
45 |
'for name: '+str(name)+'; value: '+str(value), cause) |
|
45 |
'for name: '+str(name)+'; value: '+strings.ustr(value), cause)
|
|
46 | 46 |
self.name = name |
47 | 47 |
self.value = value |
48 | 48 |
|
... | ... | |
352 | 352 |
else: return run() # don't need savepoint if cached |
353 | 353 |
except Exception, e: |
354 | 354 |
if not recover: raise # need savepoint to run index_cols() |
355 |
msg = str(e)
|
|
355 |
msg = exc.str_(e)
|
|
356 | 356 |
|
357 | 357 |
match = re.search(r'duplicate key value violates unique constraint ' |
358 | 358 |
r'"((_?[^\W_]+)_[^"]+)"', msg) |
... | ... | |
366 | 366 |
r'constraint', msg) |
367 | 367 |
if match: raise NullValueException([match.group(1)], e) |
368 | 368 |
|
369 |
match = re.search(r'invalid input (?:syntax|value)\b.*: "(\w+)"\n'
|
|
369 |
match = re.search(r'invalid input (?:syntax|value)\b.*: "(.+)"\n'
|
|
370 | 370 |
r'(?:(?s).*)\bfunction "(\w+)".*\bat assignment', msg) |
371 | 371 |
if match: |
372 |
raise FunctionValueException(match.group(2), match.group(1), e) |
|
372 |
raise FunctionValueException(match.group(2), |
|
373 |
strings.to_unicode(match.group(1)), e) |
|
373 | 374 |
|
374 | 375 |
match = re.search(r'relation "(\w+)" already exists', msg) |
375 | 376 |
if match: raise DuplicateTableException(match.group(1), e) |
Also available in: Unified diff
sql.py: FunctionValueException parsing: Support values containing non-word and non-ASCII characters