Revision 5718
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_io.py | ||
---|---|---|
454 | 454 |
log_debug('Exception already seen, handler broken') |
455 | 455 |
on_error(e) |
456 | 456 |
remove_all_rows() |
457 |
return False |
|
457 | 458 |
else: exc_strs.add(e_str) |
459 |
return True |
|
458 | 460 |
|
459 | 461 |
ignore_all_ref = [False] |
460 | 462 |
def remove_all_rows(): |
... | ... | |
611 | 613 |
main_select, **insert_args) |
612 | 614 |
break # insert successful |
613 | 615 |
except sql.MissingCastException, e: |
614 |
log_exc(e)
|
|
616 |
if not log_exc(e): break
|
|
615 | 617 |
|
616 | 618 |
type_ = e.type |
617 | 619 |
if e.col == None: out_cols = mapping.keys() |
... | ... | |
627 | 629 |
errors_table_) |
628 | 630 |
break # cast successful |
629 | 631 |
except sql.InvalidValueException, e: |
630 |
log_exc(e)
|
|
632 |
if not log_exc(e): break
|
|
631 | 633 |
|
632 | 634 |
ignore(in_col, e.value, e) |
633 | 635 |
except sql.DuplicateKeyException, e: |
634 |
log_exc(e)
|
|
636 |
if not log_exc(e): break
|
|
635 | 637 |
|
636 | 638 |
# Different rows violating different unique constraints not |
637 | 639 |
# supported |
... | ... | |
652 | 654 |
join_cols.values()) |
653 | 655 |
insert_in_tables.append(insert_in_table) |
654 | 656 |
except sql.NullValueException, e: |
655 |
log_exc(e)
|
|
657 |
if not log_exc(e): break
|
|
656 | 658 |
|
657 | 659 |
out_col, = e.cols |
658 | 660 |
try: in_col = mapping[out_col] |
... | ... | |
664 | 666 |
remove_all_rows() |
665 | 667 |
else: ignore(in_col, None, e) |
666 | 668 |
except sql.CheckException, e: |
667 |
log_exc(e)
|
|
669 |
if not log_exc(e): break
|
|
668 | 670 |
|
669 | 671 |
ensure_cond(e.cond, e, failed=True) |
670 | 672 |
except sql.InvalidValueException, e: |
671 |
log_exc(e)
|
|
673 |
if not log_exc(e): break
|
|
672 | 674 |
|
673 | 675 |
for in_col in mapping.values(): ignore(in_col, e.value, e) |
674 | 676 |
except psycopg2.extensions.TransactionRollbackError, e: |
675 |
log_exc(e)
|
|
677 |
if not log_exc(e): break
|
|
676 | 678 |
# retry |
677 | 679 |
except sql.DatabaseErrors, e: |
678 |
log_exc(e)
|
|
680 |
if not log_exc(e): break
|
|
679 | 681 |
|
680 | 682 |
log_debug('No handler for exception') |
681 | 683 |
on_error(e) |
Also available in: Unified diff
sql_io.py: put_table(): log_exc(): Return False if removing all rows and have callers break the main loop so that no further exception-handling code is processed before the main loop is exited