Re: Have better wording for snapshot file reading failure

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-09-13T11:19:38Z
Lists: pgsql-hackers
> On 13 Sep 2023, at 08:18, Michael Paquier <michael@paquier.xyz> wrote:

>     f = AllocateFile(path, PG_BINARY_R);
>     if (!f)
>         ereport(ERROR,
> -                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> -                 errmsg("invalid snapshot identifier: \"%s\"", idstr)));
> +                (errcode_for_file_access(),
> +                 errmsg("could not open file \"%s\" for reading: %m",
> +                        path)));
> 
> Agreed that this just looks like a copy-pasto.  The path provides
> enough context about what's being read, so using this generic error
> message is fine.  Will apply if there are no objections.

+1. This errmsg is already present so it eases the translation burden as well.

--
Daniel Gustafsson




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve error message for snapshot import in snapmgr.c, take two

  2. Revert "Improve error message on snapshot import in snapmgr.c"

  3. Improve error message on snapshot import in snapmgr.c