• Kirill Smelkov's avatar
    zodbcommit: Provide full context when reporting errors · 129afa67
    Kirill Smelkov authored
    In the previous patch we taught object copy handler to report more
    details, but it was still incomplete - the error was missing details
    about which operation was run - commit, or restore of particular
    Noting that it can be also noted that other errors reported from that
    function lack such context.
    -> So fix it universally, at least for zodbcommit for now: set top-level
    runctx to topic of what we are doing, and use that runctx when
    generating errors. Runctx describes what we are running, and could be
    also later used for logging and tracing. That's why it is called runctx
    instead of just errctx for "error context".
    TODO currently it is only exceptions that we explicitly raise which get
    the context. If an exception is raised by something that we call - the
    context won't be added. It would be good to later rework error handling
    and append such context for any raised error. Defer and
    https://lab.nexedi.com/kirr/go123/blob/863c4602/xerr/__init__.py has
    something preliminary for this.
    The particular error when restoring a missing object copy becomes
        ValueError: /tmp/demo002868462/δ0285cbac75555580/δ.fs: restore 0285cbacb70a3db3 @0285cbacb258bf66: object 0000000000000003: copy from @0285cbac70a3d733: no data
    instead of older
        ValueError: /tmp/demo358030847/δ0285cbac75555580/δ.fs: object 0000000000000003: copy from @0285cbac70a3d733: no data
    /reviewed-by @jerome
    /reviewed-on nexedi/zodbtools!20
Last commit
Last update
zodbtools Loading commit data...
.gitignore Loading commit data...
.nxdtest Loading commit data...
CHANGELOG.rst Loading commit data...
COPYING Loading commit data...
LICENSE-ZPL.txt Loading commit data...
MANIFEST.in Loading commit data...
README.rst Loading commit data...
setup.py Loading commit data...
tox.ini Loading commit data...