Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package billing
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrPlanNameRequired = errors.New("name required")
|
||||
ErrPlanNotFound = errors.New("plan not found")
|
||||
ErrAmountRequired = errors.New("amount required")
|
||||
ErrStripeNoCustomer = errors.New("no stripe customer for this company — complete a checkout first")
|
||||
)
|
||||
|
||||
// ClientError reports whether err is a known client-facing billing/Stripe error.
|
||||
func ClientError(err error) (msg string, ok bool) {
|
||||
switch {
|
||||
case err == nil:
|
||||
return "", false
|
||||
case errors.Is(err, ErrPlanNameRequired),
|
||||
errors.Is(err, ErrPlanNotFound),
|
||||
errors.Is(err, ErrAmountRequired),
|
||||
errors.Is(err, ErrStripeNotConfigured),
|
||||
errors.Is(err, ErrStripePlanUnsupported),
|
||||
errors.Is(err, ErrStripePriceMissing),
|
||||
errors.Is(err, ErrStripeNoCustomer),
|
||||
errors.Is(err, ErrInsufficientCredits),
|
||||
errors.Is(err, ErrProductLimitExceeded),
|
||||
errors.Is(err, ErrAIRequiresUpgrade),
|
||||
errors.Is(err, ErrEPRELRequiresUpgrade),
|
||||
errors.Is(err, ErrUnknownFeatureKey),
|
||||
errors.Is(err, ErrUnknownFeatureSection),
|
||||
errors.Is(err, ErrInvalidFeatureGates),
|
||||
errors.Is(err, ErrFeatureDisabled):
|
||||
return err.Error(), true
|
||||
default:
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user