Project

General

Profile

« Previous | Next » 

Revision 3596

sql_gen.py: plpythonu_error_handler: Always raise PL/Python exceptions as data_exception so they go in the errors table, instead of aborting the iteration

View differences:

lib/sql_gen.py
670 670
    exc_name text := matches[1];
671 671
    msg text := matches[2];
672 672
BEGIN
673
    -- Translate specific Python exception types to PostgreSQL error codes
674
    IF exc_name = 'ValueError' THEN
675
        RAISE data_exception USING MESSAGE = msg;
676
    /* Re-raise other PL/Python exceptions with the PL/Python prefix removed.
677
    This allows the exception to be parsed like a native exception. */
678
    ELSIF exc_name IS NOT NULL AND SQLERRM LIKE '%PL/Python%' THEN
679
        RAISE E'%\\nDETAIL:  Python exception class: %', msg, exc_name; 
673
    /* Re-raise PL/Python exceptions with the PL/Python prefix removed.
674
    This allows the exception to be parsed like a native exception.
675
    Always raise as data_exception so it goes in the errors table. */
676
    IF exc_name IS NOT NULL AND SQLERRM LIKE '%PL/Python%' THEN
677
        RAISE data_exception USING MESSAGE =
678
            msg||E'\\nDETAIL:  Python exception class: '||exc_name; 
680 679
    -- Re-raise non-PL/Python exceptions
681 680
    ELSE
682 681
        '''+reraise_exc+'''\

Also available in: Unified diff