config_parse.py: add _append_error_ctx() to remove redundant code
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 20 May 2020 18:58:16 +0000 (14:58 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 22 May 2020 16:30:18 +0000 (12:30 -0400)
commit131d409aec353d60590dde0c5407639d071963f7
tree684e52e466add8112d5224f6b3db3adf4a5a8bbe
parent7f4429f296135cb942e26c019bb6ef727322ead9
config_parse.py: add _append_error_ctx() to remove redundant code

_append_error_ctx() appends context to a given `ConfigParseError`
exception and then reraises it.

Using

    catch ConfigParseError as exc:
        _append_error_ctx(exc, 'My object', 'My message')

instead of

    catch ConfigParseError as exc:
        exc.append_ctx('My object', 'My message')
        raise

makes sure we don't forget to reraise.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/config_parse.py
This page took 0.023994 seconds and 4 git commands to generate.