Page MenuHomeSoftware Heritage

Add logging when escaping data fails in BaseDb.copy_to
ClosedPublic

Authored by olasd on Aug 14 2019, 3:44 PM.

Details

Summary

When escaping a value fails when running a copy_to, there's currently
no diagnostics output. This patch adds some more information as log messages.

Test Plan

tox and tox in swh.storage with the code change

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/core/db/__init__.py
189–195

You may be able to do something equivalent with simpler code:

except Exception:
    logger.exception(
        'Could not escape value `%r` for column `%s`',
        value, k)
    raise
This revision is now accepted and ready to land.Aug 19 2019, 11:06 AM
swh/core/db/__init__.py
187

This line can probably be moved outside the try.

This revision was automatically updated to reflect the committed changes.