-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
44 lines (35 loc) · 1.31 KB
/
errors.go
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
43
44
package main
type Error struct {
// Error message.
E string `json:"error"`
// ErrorCode uint `json:"error_code"`
}
// error interface impl.
func (e Error) Error() string {
return e.E
}
var (
// General errors.
ErrorBadRequest = Error{"oops! bad request"}
ErrorInternal = Error{"oops! internal server error, check logs"}
// Databse errors.
ErrorCreateFailed = Error{"failed to create record in db, check logs"}
ErrorGetFailed = Error{"failed to get record from db, check logs"}
// Board API errors.
ErrorEmptyLink = Error{"link field is empty"}
ErrorEmptyName = Error{"name field is empty"}
// Captcha API errors.
ErrorNewCaptcha = Error{"failed to generate new captcha, check logs"}
ErrorNoCaptchaId = Error{"no captcha id provided"}
ErrorInvalidCaptchaId = Error{"invalid id or captcha expired"}
// Posting API errors.
// Bans and other dynamic errors isn't hardcoded here.
ErrorBumpFailed = Error{"failed to bump parent thread, check logs"}
ErrorEmptySubject = Error{"empty subject for thread"}
ErrorNameTooLong = Error{"name is too long"}
ErrorInvalidCaptcha = Error{"captcha is invalid or has expired"}
// Files uploading errors.
ErrorTooLarge = Error{"file is too large"}
ErrorInvalidSignature = Error{"unknown file's signature"}
// todo(zvezdochka): HTML pages errors.
)