-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
40 lines (30 loc) · 1.3 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package alerting
import (
"errors"
"fmt"
radixhttp "github.com/equinor/radix-common/net/http"
)
func MultipleAlertingConfigurationsError() error {
return radixhttp.CoverAllError(errors.New("multiple alert configurations found"), radixhttp.Server)
}
func AlertingNotEnabledError() error {
return radixhttp.CoverAllError(errors.New("alerting is not enabled"), radixhttp.User)
}
func InvalidAlertReceiverError(alert, receiver string) error {
return radixhttp.CoverAllError(fmt.Errorf("invalid receiver %s for alert %s", receiver, alert), radixhttp.User)
}
func InvalidAlertError(alert string) error {
return radixhttp.CoverAllError(fmt.Errorf("alert %s is not valid", alert), radixhttp.User)
}
func AlertingAlreadyEnabledError() error {
return radixhttp.CoverAllError(errors.New("alerting already enabled"), radixhttp.User)
}
func UpdateReceiverSecretNotDefinedError(receiverName string) error {
return radixhttp.CoverAllError(fmt.Errorf("receiver %s in receiverSecrets is not defined in receivers", receiverName), radixhttp.User)
}
func InvalidSlackURLError(underlyingError error) error {
return radixhttp.CoverAllError(fmt.Errorf("invalid slack url: %v", underlyingError), radixhttp.User)
}
func InvalidSlackURLSchemeError() error {
return InvalidSlackURLError(errors.New("invalid scheme, must be https"))
}