// vipsError converts from vips to Go errors. func vipsError(e C.int) error { if e == 0 { return nil } // The VIPS error buffer is global, and checking and clearing it are // not atomic. If errors are infrequent, this will probably return // our error. It may also return nothing or unrelated errors. // TODO: Consider vips_error_freeze() and skipping this. s := C.GoString(C.vips_error_buffer()) C.vips_error_clear() if s != "" { return errors.New(s) } // At least return something generic. return ErrImageOp }
func resizeError() error { s := C.GoString(C.vips_error_buffer()) C.vips_error_clear() return errors.New(s) }
func catchVipsError() error { s := C.GoString(C.vips_error_buffer()) C.vips_error_clear() C.vips_thread_shutdown() return errors.New(s) }