A community based topic aggregation platform built on atproto
1package identity
2
3import "fmt"
4
5// ErrNotFound is returned when an identity cannot be resolved
6type ErrNotFound struct {
7 Identifier string
8 Reason string
9}
10
11func (e *ErrNotFound) Error() string {
12 if e.Reason != "" {
13 return fmt.Sprintf("identity not found: %s (%s)", e.Identifier, e.Reason)
14 }
15 return fmt.Sprintf("identity not found: %s", e.Identifier)
16}
17
18// ErrInvalidIdentifier is returned for malformed handles or DIDs
19type ErrInvalidIdentifier struct {
20 Identifier string
21 Reason string
22}
23
24func (e *ErrInvalidIdentifier) Error() string {
25 return fmt.Sprintf("invalid identifier %s: %s", e.Identifier, e.Reason)
26}
27
28// ErrCacheMiss is returned when an identifier is not in the cache
29type ErrCacheMiss struct {
30 Identifier string
31}
32
33func (e *ErrCacheMiss) Error() string {
34 return fmt.Sprintf("cache miss: %s", e.Identifier)
35}
36
37// ErrResolutionFailed is returned when resolution fails for reasons other than not found
38type ErrResolutionFailed struct {
39 Identifier string
40 Reason string
41}
42
43func (e *ErrResolutionFailed) Error() string {
44 return fmt.Sprintf("resolution failed for %s: %s", e.Identifier, e.Reason)
45}