diff options
| author | 2021-08-20 12:26:56 +0200 | |
|---|---|---|
| committer | 2021-08-20 12:26:56 +0200 | |
| commit | 4920229a3b6e1d7dde536bc9ff766542b05d935c (patch) | |
| tree | a9423beccec5331c372f01eedf38949dfb171e9e /internal/db/error.go | |
| parent | Text/status parsing fixes (#141) (diff) | |
| download | gotosocial-4920229a3b6e1d7dde536bc9ff766542b05d935c.tar.xz | |
Database updates (#144)
* start moving some database stuff around
* continue moving db stuff around
* more fiddling
* more updates
* and some more
* and yet more
* i broke SOMETHING but what, it's a mystery
* tidy up
* vendor ttlcache
* use ttlcache
* fix up some tests
* rename some stuff
* little reminder
* some more updates
Diffstat (limited to 'internal/db/error.go')
| -rw-r--r-- | internal/db/error.go | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/internal/db/error.go b/internal/db/error.go index 197c7bd68..c13bd78dd 100644 --- a/internal/db/error.go +++ b/internal/db/error.go @@ -18,16 +18,18 @@ package db -// ErrNoEntries is to be returned from the DB interface when no entries are found for a given query. -type ErrNoEntries struct{} +import "fmt" -func (e ErrNoEntries) Error() string { - return "no entries" -} +// Error denotes a database error. +type Error error -// ErrAlreadyExists is to be returned from the DB interface when an entry already exists for a given query or its constraints. -type ErrAlreadyExists struct{} - -func (e ErrAlreadyExists) Error() string { - return "already exists" -} +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") + // ErrAlreadyExists is returned when a caller tries to insert a database entry that already exists in the db. + ErrAlreadyExists Error = fmt.Errorf("already exists") + // ErrUnknown denotes an unknown database error. + ErrUnknown Error = fmt.Errorf("unknown error") +) |
