A community based topic aggregation platform built on atproto
1package users
2
3import "fmt"
4
5// Domain errors for user service operations
6// These map to lexicon error types defined in social.coves.actor.signup
7
8type InvalidHandleError struct {
9 Handle string
10 Reason string
11}
12
13func (e *InvalidHandleError) Error() string {
14 return fmt.Sprintf("invalid handle %q: %s", e.Handle, e.Reason)
15}
16
17type HandleNotAvailableError struct {
18 Handle string
19}
20
21func (e *HandleNotAvailableError) Error() string {
22 return fmt.Sprintf("handle %q is not available", e.Handle)
23}
24
25type InvalidInviteCodeError struct {
26 Code string
27}
28
29func (e *InvalidInviteCodeError) Error() string {
30 return "invalid or expired invite code"
31}
32
33type InvalidEmailError struct {
34 Email string
35}
36
37func (e *InvalidEmailError) Error() string {
38 return fmt.Sprintf("invalid email address: %q", e.Email)
39}
40
41type WeakPasswordError struct {
42 Reason string
43}
44
45func (e *WeakPasswordError) Error() string {
46 return fmt.Sprintf("password does not meet strength requirements: %s", e.Reason)
47}
48
49// PDSError wraps errors from the PDS that we couldn't map to domain errors
50type PDSError struct {
51 Message string
52 StatusCode int
53}
54
55func (e *PDSError) Error() string {
56 return fmt.Sprintf("PDS error (%d): %s", e.StatusCode, e.Message)
57}