Skip to content

repository: Standardize errors creation

Pavlo Strokov requested to merge ps-repository-fix into master

The old %v format replaced with the error wrapping %w format. It will allow to extract error from the text context and veridy error equality more strict. The status.Errorf() calls replaced with function calls from helper package corresponding to the used status code. The checks to define if an error is a status package entity are not needed if functions from the helper package are used. They detect status entities internally and prevent double-wrapping. The prefixes same as gRPC method names removed from the error messages as they are redundant. The check for the status code in the extractSnapshot() method replaced from naive one (it doesn't work if there is an error wrapping happens somewhere) to the usage of a special helper.GrpcCode() function as well as strings.HasPrefix() changed to strings.Contains() because of the same.

Part of: #4471 (closed)

Merge request reports