Welcome to mirror list, hosted at ThFree Co, Russian Federation.

unavailable_code_test.go « unavailable_code « src « testdata « gitaly « golangci-lint « tools - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b107aa4aeb023f4f8a5aa102d490a5e31b0e8602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package unavailable_code

import (
	"fmt"
)

func NewUnavailable(msg string) error {
	return fmt.Errorf("unavailable: %s", msg)
}

func NewAborted(msg string) error {
	return fmt.Errorf("aborted: %s", msg)
}

func errorWrapOkay() {
	_ = NewAborted("hello world")
}

func errorWrapNotOkay() {
	_ = NewUnavailable("hello world") // want "please avoid using the Unavailable status code.*"
}