File size: 780 Bytes
d6f631f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
package secretentity

import (
	"errors"
	"fmt"

	"github.com/openmeterio/openmeter/pkg/models"
)

var _ models.GenericError = (*SecretNotFoundError)(nil)

func NewSecretNotFoundError(id SecretID) *SecretNotFoundError {
	return &SecretNotFoundError{
		err: models.NewGenericNotFoundError(
			fmt.Errorf("app with id %s not found in %s namespace", id.ID, id.Namespace),
		),
	}
}

type SecretNotFoundError struct {
	err error
}

func (e *SecretNotFoundError) Error() string {
	return e.err.Error()
}

func (e *SecretNotFoundError) Unwrap() error {
	return e.err
}

// IsSecretNotFoundError returns true if the error is a SecretNotFoundError.
func IsSecretNotFoundError(err error) bool {
	if err == nil {
		return false
	}

	var e *SecretNotFoundError

	return errors.As(err, &e)
}