Debian Codegraph @

pkg/services/chat/discord/discord_errors.go

raw
1 package discord
2
3 import "errors"
4
5 // Error definitions for the Discord service.
6 var (
7 // ErrEmptyMessage is returned when attempting to send an empty message.
8 ErrEmptyMessage = errors.New("message is empty")
9
10 // ErrUnknownAPIError indicates an unknown error from the Discord API.
11 ErrUnknownAPIError = errors.New("unknown error from Discord API")
12
13 // ErrUnexpectedStatus indicates an unexpected HTTP response status code.
14 ErrUnexpectedStatus = errors.New("unexpected response status code")
15
16 // ErrInvalidURLPrefix indicates the URL must start with Discord webhook base URL.
17 ErrInvalidURLPrefix = errors.New("URL must start with Discord webhook base URL")
18
19 // ErrInvalidScheme indicates an invalid URL scheme; must be https.
20 ErrInvalidScheme = errors.New("invalid URL scheme: must be https")
21
22 // ErrInvalidHost indicates an invalid host; must be discord.com.
23 ErrInvalidHost = errors.New("invalid host: must be discord.com")
24
25 // ErrInvalidWebhookID indicates an invalid webhook ID.
26 ErrInvalidWebhookID = errors.New("invalid webhook ID")
27
28 // ErrInvalidToken indicates an invalid token.
29 ErrInvalidToken = errors.New("invalid token")
30
31 // ErrEmptyURL indicates an empty URL was provided.
32 ErrEmptyURL = errors.New("empty URL provided")
33
34 // ErrMalformedURL indicates a malformed URL missing webhook ID or token.
35 ErrMalformedURL = errors.New("malformed URL: missing webhook ID or token")
36
37 // ErrRateLimited indicates rate limiting by Discord.
38 ErrRateLimited = errors.New("rate limited by Discord")
39
40 // ErrMaxRetries indicates max retries exceeded.
41 ErrMaxRetries = errors.New("max retries exceeded")
42
43 // ErrIllegalURLArgument indicates an illegal argument in config URL.
44 ErrIllegalURLArgument = errors.New("illegal argument in config URL")
45
46 // ErrMissingWebhookID indicates webhook ID missing from config URL.
47 ErrMissingWebhookID = errors.New("webhook ID missing from config URL")
48
49 // ErrMissingToken indicates token missing from config URL.
50 ErrMissingToken = errors.New("token missing from config URL")
51 )