2fas-server/internal/common/db/error.go
Krzysztof Dryś e6bfee866a
fix: error handling in icons endpoints (first batch) (#16)
fix: error handling in icons endpoints (first batch)

Update error handling for some icons endpoints.
2023-11-28 12:52:56 +01:00

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)
}