File size: 537 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
package subscriptionentitlement

import (
	"fmt"
	"time"

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

type NotFoundError struct {
	ItemID models.NamespacedID
	At     time.Time
}

func (e *NotFoundError) Error() string {
	msg := "subscription entitlement not found"
	if e.ItemID.ID != "" {
		msg = fmt.Sprintf("%s for item %s", msg, e.ItemID.ID)
	}
	if e.ItemID.Namespace != "" {
		msg = fmt.Sprintf("%s in namespace %s", msg, e.ItemID.Namespace)
	}
	if !e.At.IsZero() {
		msg = fmt.Sprintf("%s at %s", msg, e.At)
	}

	return msg
}