public

package
v0.0.0-...-431252f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2022 License: BSL-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Admin = struct {
	NoRights    error
	NotSuper    error
	WrongFormat error

	NotAdmin     error
	AdminAlready error
	EditSuper    error

	ReportsNotFound error

	IDNotFound error
}{
	NoRights: errors.New("you are not admin<br>ask <a href='https://t.me/ebashu_gerych'>owners</a> to become one"),

	NotSuper: errors.New("only super admin can use this"),

	WrongFormat: errors.New("wrong field format"),

	ReportsNotFound: errors.New("reports not found"),

	AdminAlready: errors.New("user is already admin"),
	NotAdmin:     errors.New("user is not admin"),
	EditSuper:    errors.New("managing super accounts is forbidden"),
	IDNotFound:   errors.New("id not found"),
}
View Source
var Cookie = struct {
	CookieError error
	MaxAge      int64
}{
	CookieError: errors.New("cookie error! Please, try <a href='/login'>Login</a> again"),
	MaxAge:      int64(time.Hour * 24 * 7),
}
View Source
var Forgot = struct {
	SamePassword error
}{
	SamePassword: errors.New("this is your actual password :)<br><a href='/login'>login</a>"),
}
View Source
var Internal = InternalWithError{errors.New("internal service error, try again later")}
View Source
var JSON = jsonTools{}
View Source
var Login = struct {
	MailExist         error
	MailNotFound      error
	IncorrectPassword error
}{
	MailExist:         errors.New("email Already Exists"),
	MailNotFound:      errors.New("mail Not Found"),
	IncorrectPassword: errors.New("incorrect password"),
}
View Source
var Redis = struct {
	ExpireSeconds int
}{
	ExpireSeconds: 300,
}
View Source
var Register = struct {
	PasswordMin int
	PasswordMax int

	InvalidLength error
	InvalidFormat error
	KeyNotFound   error
}{
	PasswordMin: 8,
	PasswordMax: 128,

	InvalidLength: fmt.Errorf("invalid password format: min length %d and max %d", 8, 128),
	InvalidFormat: fmt.Errorf(
		"invalid password format: At least one number, lower/upper letter with min length %d and max %d", 8, 128,
	),
	KeyNotFound: errors.New("key not found or expired"),
}
View Source
var Reports = struct {
	StillProcessing error

	IsChecked error
	NotFound  error
}{
	StillProcessing: errors.New("your previous report is still processed"),
	IsChecked:       errors.New("report is already checked"),
	NotFound:        errors.New("report not found"),
}
View Source
var Session = struct {
	SessionTimoutDays int // Is used in old sessions checks

	// // Errors
	NoSession  error
	OldSession error
}{

	SessionTimoutDays: 7,

	NoSession: errors.New(
		"Session not found!\nPlease <a href=\"/login\">login</a> or <a href=\"/register\">register</a>",
	),
	OldSession: errors.New("Your session is old enough!\nPlease <a href=\"/login\">login</a> again"),
}

Functions

func NewInternalWithError

func NewInternalWithError(err error) error

func WriteWithCode

func WriteWithCode(w http.ResponseWriter, statusCode int, elements ...any) (int, error)

Types

type InternalWithError

type InternalWithError struct {
	InternalError error
}

InternalWithError is used to detect internal error instead of non-panic

func (InternalWithError) Error

func (int InternalWithError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL