/*
* This file is part of sdbapi
* Copyright (C) 2022 Jonni Liljamo <jonni@liljamo.com>
*
* Licensed under GPL-3.0-only.
* See LICENSE for licensing information.
*/
package apierror
// general errors
var (
Placeholder APIError = APIError{1000, "Placeholder", "placeholder"}
InvalidInput APIError = APIError{1001, "InvalidInput", "invalid input"}
NotAuthorized APIError = APIError{1002, "NotAuthorized", "not authorized"}
MissingAuth APIError = APIError{1003, "MissingAuthorization", "missing authorization"}
GenericJWTError APIError = APIError{1004, "GenericJWTError", ""}
)
// user related errors
var (
UserNotFound APIError = APIError{2000, "UserNotFound", "user not found"}
InvalidCred APIError = APIError{2001, "InvalidCred", "invalid credentials"}
NewJWTError APIError = APIError{2003, "NewJWTError", "jwt creation error"}
// login errors
EmailInvalid APIError = APIError{2100, "EmailInvalid", "invalid email address"}
UsernameTooShort APIError = APIError{2101, "UsernameTooShort", "username should not be shroter than 3 characters"}
PasswordTooShort APIError = APIError{2102, "PasswordTooShort", "password should not be shorter than 8 characters"}
PasswordHashFailed APIError = APIError{2103, "PasswordHashFailed", "password hash failed"}
UserCreationFailed APIError = APIError{2104, "UserCreationFailed", "user creation failed"}
)
// game related errors
var (
GameNotFound APIError = APIError{3000, "GameNotFound", "game not found"}
GameCreationFailed APIError = APIError{3001, "GameCreationFailed", "game creation failed"}
GetAllFormingFailed APIError = APIError{3002, "GetAllFormingFailed", "failed to get all forming games"}
GameStatePatchFailed APIError = APIError{3003, "GameStatePatchFailed", "failed to patch game state"}
NoGamesForUser APIError = APIError{3004, "NoGamesForUser", "no games found for user"}
GameNotForming APIError = APIError{3005, "GameNotForming", "game is not forming"}
CannotJoinOwnGame APIError = APIError{3006, "CannotJoinOwnGame", "can not join own game"}
GameFull APIError = APIError{3007, "GameFull", "game is full"}
)
type APIError struct {
ID uint16 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}