errors.go 624 B

1234567891011121314151617181920212223242526272829303132
  1. package vips
  2. import (
  3. "fmt"
  4. "github.com/imgproxy/imgproxy/v3/ierrors"
  5. )
  6. type (
  7. VipsError string
  8. ColorError string
  9. )
  10. func newVipsError(msg string) error {
  11. return ierrors.Wrap(VipsError(msg), 1)
  12. }
  13. func newVipsErrorf(format string, args ...interface{}) error {
  14. return ierrors.Wrap(VipsError(fmt.Sprintf(format, args...)), 1)
  15. }
  16. func (e VipsError) Error() string { return string(e) }
  17. func newColorError(format string, args ...interface{}) error {
  18. return ierrors.Wrap(
  19. ColorError(fmt.Sprintf(format, args...)),
  20. 1,
  21. ierrors.WithShouldReport(false),
  22. )
  23. }
  24. func (e ColorError) Error() string { return string(e) }