Classifies errors into categories for Stripe CLI error handling.
// Source: https://github.com/stripe/stripe-cli | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package reporting
import (
"context"
"errors"
"net"
"net/url"
"os"
"github.com/spf13/pflag"
"github.com/stripe/stripe-cli/pkg/errorcategory"
"github.com/stripe/stripe-cli/pkg/requests"
)
func classifyError(err error) errorcategory.Category {
if category, ok := errorcategory.Get(err); ok {
return category
}
var flagNotFound *pflag.NotExistError
if errors.As(err, &flagNotFound) {
return errorcategory.UserInput
}
var flagValueRequired *pflag.ValueRequiredError
if errors.As(err, &flagValueRequired) {
return errorcategory.UserInput
}
if statusCode, ok := request
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key