2025-02-18 17:35:13 +03:00
|
|
|
package processing
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
|
2025-11-20 01:26:21 +06:00
|
|
|
"github.com/imgproxy/imgproxy/v3/errctx"
|
2025-02-18 17:35:13 +03:00
|
|
|
"github.com/imgproxy/imgproxy/v3/imagetype"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type (
|
2025-11-20 01:26:21 +06:00
|
|
|
SaveFormatError struct{ *errctx.TextError }
|
2025-02-18 17:35:13 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func newSaveFormatError(format imagetype.Type) error {
|
2025-11-20 01:26:21 +06:00
|
|
|
return SaveFormatError{errctx.NewTextError(
|
|
|
|
|
fmt.Sprintf("Can't save %s, probably not supported by your libvips", format),
|
2025-02-18 17:35:13 +03:00
|
|
|
1,
|
2025-11-20 01:26:21 +06:00
|
|
|
errctx.WithStatusCode(http.StatusUnprocessableEntity),
|
|
|
|
|
errctx.WithPublicMessage("Invalid URL"),
|
|
|
|
|
errctx.WithShouldReport(false),
|
|
|
|
|
)}
|
2025-02-18 17:35:13 +03:00
|
|
|
}
|