Files
stream.api/internal/modules/payments/errors.go
2026-03-26 13:02:43 +00:00

34 lines
618 B
Go

package payments
import (
"net/http"
"google.golang.org/grpc/codes"
"stream.api/internal/modules/common"
)
func newValidationError(message string, data map[string]any) *PaymentValidationError {
return &PaymentValidationError{
GRPCCode: int(codes.InvalidArgument),
HTTPCode: http.StatusBadRequest,
Message: message,
Data: data,
}
}
func (e *PaymentValidationError) Error() string {
if e == nil {
return ""
}
return e.Message
}
func (e *PaymentValidationError) apiBody() common.APIErrorBody {
return common.APIErrorBody{
Code: e.HTTPCode,
Message: e.Message,
Data: e.Data,
}
}