zabgrab.services.config

Config loading with interactive repair of invalid files.

Functions

load_with_repair(load, ui, editor)

Call load; if a config file is invalid, offer to open it for editing.

zabgrab.services.config.load_with_repair(load, ui, editor)[source]

Call load; if a config file is invalid, offer to open it for editing.

Interactive sessions are shown the error and offered the editor, after which loading is retried. Otherwise (or if the user declines) the error is raised.

Parameters:
  • load (callable) – Loads the config.

  • ui (UI) – Shows the error and asks about editing.

  • editor (Editor) – Opens the file.

Returns:

T – What load returns.

Raises:

ConfigError – If a file is invalid and isn’t fixed (marked as reported if the user was already shown it).

Return type:

T