mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Implemented Badge Management in administration panel (#29798)
Co-authored-by: Diogo Vicente <diogo.m.s.vicente@tecnico.ulisboa.pt>
This commit is contained in:
committed by
Henrique Pimentel
co-authored by
Diogo Vicente
parent
7adf8d7727
commit
8b86c3140a
@@ -107,3 +107,44 @@ func IsErrUserIsNotLocal(err error) bool {
|
||||
_, ok := err.(ErrUserIsNotLocal)
|
||||
return ok
|
||||
}
|
||||
|
||||
// ErrBadgeAlreadyExist represents a "badge already exists" error.
|
||||
type ErrBadgeAlreadyExist struct {
|
||||
Slug string
|
||||
}
|
||||
|
||||
// IsErrBadgeAlreadyExist checks if an error is a ErrBadgeAlreadyExist.
|
||||
func IsErrBadgeAlreadyExist(err error) bool {
|
||||
_, ok := err.(ErrBadgeAlreadyExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrBadgeAlreadyExist) Error() string {
|
||||
return fmt.Sprintf("badge already exists [slug: %s]", err.Slug)
|
||||
}
|
||||
|
||||
// Unwrap unwraps this error as a ErrExist error
|
||||
func (err ErrBadgeAlreadyExist) Unwrap() error {
|
||||
return util.ErrAlreadyExist
|
||||
}
|
||||
|
||||
// ErrBadgeNotExist represents a "BadgeNotExist" kind of error.
|
||||
type ErrBadgeNotExist struct {
|
||||
Slug string
|
||||
ID int64
|
||||
}
|
||||
|
||||
// IsErrBadgeNotExist checks if an error is a ErrBadgeNotExist.
|
||||
func IsErrBadgeNotExist(err error) bool {
|
||||
_, ok := err.(ErrBadgeNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrBadgeNotExist) Error() string {
|
||||
return fmt.Sprintf("badge does not exist [slug: %s | id: %i]", err.Slug, err.ID)
|
||||
}
|
||||
|
||||
// Unwrap unwraps this error as a ErrNotExist error
|
||||
func (err ErrBadgeNotExist) Unwrap() error {
|
||||
return util.ErrNotExist
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user