mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-27 10:43:32 +01:00
6ed368cbeb
* add ensureUserIsAuthorizedOrRedirect to /oauth/authorize * adding authorization (email confirm, account approve, etc) to TokenCheck * revert un-needed changes to signin.go * oops what happened here * error css * add account.SuspendedAt check * remove redundant checks from oauth util Authed function * wip tests * tests passing * stop stripping useful information from ErrAlreadyExists * that feeling of scraping the dryer LINT off the screen * oops I didn't mean to get rid of this NewTestRouter function * make tests work with recorder * re-add ConfigureTemplatesWithGin to handle template path err Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
47 lines
1.5 KiB
Go
47 lines
1.5 KiB
Go
/*
|
|
GoToSocial
|
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package db
|
|
|
|
import "fmt"
|
|
|
|
// Error denotes a database error.
|
|
type Error error
|
|
|
|
var (
|
|
// ErrNoEntries is returned when a caller expected an entry for a query, but none was found.
|
|
ErrNoEntries Error = fmt.Errorf("no entries")
|
|
// ErrMultipleEntries is returned when a caller expected ONE entry for a query, but multiples were found.
|
|
ErrMultipleEntries Error = fmt.Errorf("multiple entries")
|
|
// ErrUnknown denotes an unknown database error.
|
|
ErrUnknown Error = fmt.Errorf("unknown error")
|
|
)
|
|
|
|
// ErrAlreadyExists is returned when a caller tries to insert a database entry that already exists in the db.
|
|
type ErrAlreadyExists struct {
|
|
message string
|
|
}
|
|
|
|
func (e *ErrAlreadyExists) Error() string {
|
|
return e.message
|
|
}
|
|
|
|
func NewErrAlreadyExists(msg string) error {
|
|
return &ErrAlreadyExists{message: msg}
|
|
}
|