MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / newInvalidArgumentError

Function newInvalidArgumentError

options/parser/errors.go:88–95  ·  view source on GitHub ↗

newInvalidArgumentError creates a standardized error for an invalid single argument

(ctx context.Context, key, arg string, expected ...string)

Source from the content-addressed store, hash-verified

86
87// newInvalidArgumentError creates a standardized error for an invalid single argument
88func newInvalidArgumentError(ctx context.Context, key, arg string, expected ...string) error {
89 msg := "Invalid %s: %s"
90 if len(expected) > 0 {
91 msg += " (expected " + strings.Join(expected, ", ") + ")"
92 }
93
94 return newOptionArgumentError(ctx, key, msg, key, arg)
95}
96
97func errorKey(key string) string {
98 k, _, _ := strings.Cut(strings.ReplaceAll(key, "_", "-"), ".")

Callers 15

applyBackgroundOptionMethod · 0.85
applyFormatOptionMethod · 0.85
applyExpiresOptionMethod · 0.85
parsePositiveFloatMethod · 0.85
parseIntMethod · 0.85
parsePositiveIntMethod · 0.85
parseQualityIntMethod · 0.85
parseOpacityFloatMethod · 0.85
parseResolutionMethod · 0.85
parseBase64StringMethod · 0.85

Calls 1

newOptionArgumentErrorFunction · 0.85

Tested by

no test coverage detected