goshort/internal/errs/errors.go

62 lines
2.1 KiB
Go
Raw Permalink Normal View History

2023-08-17 14:14:59 -03:00
package errs
import (
"errors"
"fmt"
)
var (
// ErrInvalidConfig is returned when the configuration is invalid.
ErrInvalidConfig = errors.New("invalid configuration")
2023-08-26 11:47:46 -03:00
// ErrInvalidShort.
2023-08-17 14:14:59 -03:00
ErrInvalidShort = errors.New("invalid short")
2023-08-26 11:47:46 -03:00
// ErrShortDoesNotExist.
2023-08-17 14:14:59 -03:00
ErrShortDoesNotExist = errors.New("short does not exist")
2023-08-26 11:47:46 -03:00
// ErrShortExists.
2023-08-17 14:14:59 -03:00
ErrShortExists = errors.New("short already exists")
2023-08-26 11:47:46 -03:00
// ErrUserDoesNotExist.
2023-08-17 17:55:28 -03:00
ErrUserDoesNotExist = errors.New("user does not exist")
2023-08-26 11:47:46 -03:00
// ErrUserExists.
2023-08-17 17:55:28 -03:00
ErrUserExists = errors.New("user already exists")
2023-08-26 11:47:46 -03:00
// ErrInvalidUser.
2023-08-17 17:55:28 -03:00
ErrInvalidUser = errors.New("invalid user")
2023-08-26 11:47:46 -03:00
// ErrFailedAuthentication.
2023-08-17 19:26:33 -03:00
ErrFailedAuthentication = errors.New("failed authentication")
2023-08-26 11:47:46 -03:00
// ErrInvalidUsernameOrPassword.
2023-08-17 19:26:33 -03:00
ErrInvalidUsernameOrPassword = errors.New("invalid username or password")
2023-08-26 11:47:46 -03:00
// ErrRegistrationDisabled.
2023-08-17 19:55:08 -03:00
ErrRegistrationDisabled = errors.New("registration is disabled")
2023-08-26 11:47:46 -03:00
// ErrSessionDoesNotExist.
2023-08-21 01:19:10 -03:00
ErrSessionDoesNotExist = errors.New("session does not exist")
2023-08-26 11:47:46 -03:00
// ErrTokenDoesNotExist.
2023-08-21 01:19:10 -03:00
ErrTokenDoesNotExist = errors.New("token does not exist")
2023-08-26 11:47:46 -03:00
// ErrTokenExists.
2023-08-21 01:19:10 -03:00
ErrTokenExists = errors.New("token already exists")
2023-08-26 11:47:46 -03:00
// ErrTokenMissing.
2023-08-21 01:19:10 -03:00
ErrTokenMissing = errors.New("token missing")
2023-08-26 11:47:46 -03:00
// ErrInvalidToken.
2023-08-21 18:08:41 -03:00
ErrInvalidToken = errors.New("invalid token")
2023-08-26 11:47:46 -03:00
// ErrInvalidTokenID.
2023-08-21 18:08:41 -03:00
ErrInvalidTokenID = errors.New("invalid token ID")
2023-08-26 11:47:46 -03:00
// ErrInvalidTokenName.
2023-08-21 18:08:41 -03:00
ErrInvalidTokenName = errors.New("invalid token name")
2023-08-26 11:47:46 -03:00
// ErrDatabaseError.
2023-08-23 19:30:12 -03:00
ErrDatabaseError = errors.New("database error")
2023-08-26 11:47:46 -03:00
// ErrShortLogExists.
2023-08-25 11:05:24 -03:00
ErrShortLogExists = errors.New("short log already exists")
2023-08-27 20:44:58 -03:00
// ErrStorageNotStarted.
ErrStorageNotStarted = errors.New("storage not started")
// ErrStorageStarted.
ErrStorageStarted = errors.New("storage already started")
2024-03-09 06:44:22 -03:00
// ErrOIDCStateCookieMissing.
ErrOIDCStateCookieMissing = errors.New("OIDC state cookie missing")
// ErrOIDCStateCookieInvalid.
ErrOIDCStateCookieInvalid = errors.New("OIDC state cookie invalid")
// ErrCredentialsLoginDisabled.
ErrCredentialsLoginDisabled = errors.New("credentials login disabled")
2023-08-17 14:14:59 -03:00
)
2023-08-23 19:30:12 -03:00
func Errorf(msg string, err error) error {
return fmt.Errorf("%s: %w", msg, err)
2023-08-17 14:14:59 -03:00
}