Project

General

Profile

« Previous | Next » 

Revision 449

bin/map: Use xml_func.process()'s new on_error error handler. Add row to database errors and xml_func.SyntaxExceptions.

View differences:

map
163 163
        try:
164 164
            if test: sql.empty_db(out_db)
165 165
            row_ct_ref = [0]
166
            
167
            def on_error(e):
168
                exc.add_msg(e, 'row:\n'+str(root))
169
                ex_tracker.track(e)
170
            
166 171
            def process_row():
167
                try: xml_func.process(root)
168
                except xml_func.SyntaxException, e: ex_tracker.track(e, False)
172
                xml_func.process(root, on_error)
169 173
                if not xml_dom.is_empty(root):
170 174
                    assert xml_dom.has_one_child(root)
171 175
                    try:
172 176
                        sql.with_savepoint(out_db, lambda: db_xml.put(out_db,
173 177
                            root.firstChild, False, row_ct_ref, out_pkeys))
174 178
                        if commit: out_db.commit()
175
                    except sql.DatabaseErrors, e: ex_tracker.track(e)
179
                    except sql.DatabaseErrors, e: on_error(e)
176 180
                root.clear()
181
            
177 182
            process_input(root, process_row)
178 183
            print 'Inserted '+str(row_ct_ref[0])+' rows'
179 184
        finally:

Also available in: Unified diff