mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 04:00:15 +01:00
e6bfee866a
fix: error handling in icons endpoints (first batch) Update error handling for some icons endpoints.
21 lines
340 B
Go
21 lines
340 B
Go
package db
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
var dbError = errors.New("database error")
|
|
|
|
func WrapError(err error) error {
|
|
return fmt.Errorf("%w: %w", dbError, err)
|
|
}
|
|
|
|
func QueryPrepError(err error) error {
|
|
return WrapError(fmt.Errorf("failed to prepare query: %w", err))
|
|
}
|
|
|
|
func IsDBError(err error) bool {
|
|
return errors.Is(err, dbError)
|
|
}
|