Skip to content

use _extract_error_message in more error paths #1301

@marceloneppel

Description

@marceloneppel

Problem

PR #1243 introduces _extract_error_message for surfacing pgBackRest error details to the user, but only uses it in _initialise_stanza and check_stanza. Several other error paths still use the generic {e!s} (ExecError string representation) or have no error handling at all, giving users unhelpful messages.

The VM charm (canonical/postgresql-operator) already uses _extract_error_message in all of these locations.

Affected branches

Affected methods

  1. _on_create_backup_action (backup failure) — uses f"Failed to backup PostgreSQL with error: {e!s}" instead of _extract_error_message(e.stderr)
  2. _list_backups — no error handling for ExecError from pgbackrest info; exception propagates raw
  3. _generate_backup_list_output — same as above, no error handling; caller in _on_list_backups_action also uses {e!s}
  4. _is_primary_pgbackrest_service_running (server-ping failure) — uses f"...with error {e!s}" instead of _extract_error_message(e.stderr)

Expected behavior

All pgBackRest error paths should extract meaningful ERROR/WARN lines from stderr and surface them to the user, either in juju status, action results, or log messages.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions