Пример #1
0
// Returns the kind, reason and description of any error that occurs when using
// other methods in this API
func (pi *PixelIterator) GetLastError() error {
	var et C.ExceptionType
	csdescription := C.PixelGetIteratorException(pi.pi, &et)
	defer C.free(unsafe.Pointer(csdescription))
	if ExceptionType(et) != EXCEPTION_UNDEFINED {
		pi.clearException()
		return &PixelIteratorException{ExceptionType(C.int(et)), C.GoString(csdescription)}
	}
	return nil
}
Пример #2
0
func (self *PixelIterator) Error() error {
	var exception C.ExceptionType

	ptr := C.PixelGetIteratorException(self.iterator, &exception)
	message := C.GoString(ptr)

	C.PixelClearIteratorException(self.iterator)
	C.MagickRelinquishMemory(unsafe.Pointer(ptr))

	return errors.New(message)
}