/
errors.go
34 lines (23 loc) 路 1.29 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
package db
import "errors"
// UserError are errors that are shown to the error
type UserError string
func (err UserError) Error() string {
return string(err)
}
// ErrUserNameTaken is thrown when user can not be created because the name is allready taken
var ErrUserNameTaken = UserError("username allready taken")
// ErrWrongPassword is thrown if the user password combination is invalid
var ErrWrongPassword = UserError("wrong password")
// ErrUserNotExists is thrown if the user does not exist
var ErrUserNotExists = UserError("username not found")
// ErrInternalServerError is thrown if something went wrong which is not ment to be shown to the user
var ErrInternalServerError = UserError("internal server error")
// ErrNoUserCredentials is shown if no user credentials are provided
var ErrNoUserCredentials = UserError("missing user credentials")
// ErrMessageToLong is thrown when the sent message is too long
var ErrMessageToLong = UserError("message is too long")
// ErrBotDoesNotBelongToUser is thrown when the sent message is too long
var ErrBotDoesNotBelongToUser = UserError("the bot does not belong to you")
// ErrConnectionClosed is thrown if a database request is made, but the connection to the database is closed
var ErrConnectionClosed = errors.New("connection is closed or not established jet")