fixed error definition

This commit is contained in:
Stephan D
2026-02-13 17:01:16 +01:00
parent de48205e68
commit 5dd1b5f4d7

View File

@@ -2,6 +2,7 @@ package storage
import ( import (
"context" "context"
"errors"
"github.com/tech/sendico/payments/storage/model" "github.com/tech/sendico/payments/storage/model"
quotestorage "github.com/tech/sendico/payments/storage/quote" quotestorage "github.com/tech/sendico/payments/storage/quote"
@@ -9,25 +10,19 @@ import (
"go.mongodb.org/mongo-driver/v2/bson" "go.mongodb.org/mongo-driver/v2/bson"
) )
type storageError string
func (e storageError) Error() string {
return string(e)
}
var ( var (
// ErrPaymentNotFound signals that a payment record does not exist. // ErrPaymentNotFound signals that a payment record does not exist.
ErrPaymentNotFound = storageError("payments.storage: payment not found") ErrPaymentNotFound = errors.New("payments.storage: payment not found")
// ErrDuplicatePayment signals that idempotency constraints were violated. // ErrDuplicatePayment signals that idempotency constraints were violated.
ErrDuplicatePayment = storageError("payments.storage: duplicate payment") ErrDuplicatePayment = errors.New("payments.storage: duplicate payment")
// ErrRouteNotFound signals that a payment route record does not exist. // ErrRouteNotFound signals that a payment route record does not exist.
ErrRouteNotFound = storageError("payments.storage: route not found") ErrRouteNotFound = errors.New("payments.storage: route not found")
// ErrDuplicateRoute signals that a route already exists for the same transition. // ErrDuplicateRoute signals that a route already exists for the same transition.
ErrDuplicateRoute = storageError("payments.storage: duplicate route") ErrDuplicateRoute = errors.New("payments.storage: duplicate route")
// ErrPlanTemplateNotFound signals that a plan template record does not exist. // ErrPlanTemplateNotFound signals that a plan template record does not exist.
ErrPlanTemplateNotFound = storageError("payments.storage: plan template not found") ErrPlanTemplateNotFound = errors.New("payments.storage: plan template not found")
// ErrDuplicatePlanTemplate signals that a plan template already exists for the same transition. // ErrDuplicatePlanTemplate signals that a plan template already exists for the same transition.
ErrDuplicatePlanTemplate = storageError("payments.storage: duplicate plan template") ErrDuplicatePlanTemplate = errors.New("payments.storage: duplicate plan template")
) )
var ( var (