mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 12:09:56 +01:00
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)
|
||
|
}
|