plugin-barman-cloud/internal/cnpgi/common/errors.go
Leonardo Cecchi e5a0aeed34 feat: return 404 for missing WAL files
The plugin now returns a 404 status code when a requested WAL file does not
exist in the object store.

This prevents misleading log entries such as "Error while handling gRPC
request" for expected missing-file scenarios.

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-09-24 19:50:03 +02:00

15 lines
414 B
Go

package common
import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// newWALNotFoundError returns a error that states that a
// certain WAL file has not been found. This error is
// compatible with GRPC status codes, resulting in a 404
// being used as a response code.
func newWALNotFoundError(walName string) error {
return status.Errorf(codes.NotFound, "wal %q not found", walName)
}