(msg string)
| 17 | type VipsError struct{ *errctx.TextError } |
| 18 | |
| 19 | func newVipsError(msg string) error { |
| 20 | var opts []errctx.Option |
| 21 | |
| 22 | for _, re := range badImageErrRe { |
| 23 | if re.MatchString(msg) { |
| 24 | opts = []errctx.Option{ |
| 25 | errctx.WithStatusCode(http.StatusUnprocessableEntity), |
| 26 | errctx.WithPublicMessage("Broken or unsupported image"), |
| 27 | } |
| 28 | break |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | return VipsError{errctx.NewTextError(msg, 1, opts...)} |
| 33 | } |
no test coverage detected