Example #1
0
// Returns the latest error reported by the MagickWand API.
func (self *Canvas) Error() error {
	var t C.ExceptionType
	ptr := C.MagickGetException(self.wand, &t)
	message := C.GoString(ptr)
	C.MagickClearException(self.wand)
	C.MagickRelinquishMemory(unsafe.Pointer(ptr))
	return errors.New(message)
}
Example #2
0
/* Returns the severity, reason, and description of any error that occurs when
   using other methods in this API.
*/
func (w *MagickWand) Exception() (string, int) {
	var severity C.ExceptionType
	errPtr := C.MagickGetException(w.wand, &severity)
	C.MagickClearException(w.wand)
	err := C.GoString(errPtr)
	C.MagickRelinquishMemory(unsafe.Pointer(errPtr))
	return err, int(severity)
}
Example #3
0
func (self *PixelIterator) Error() error {
	var exception C.ExceptionType

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

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

	return errors.New(message)
}
Example #4
0
// Clears any exceptions associated with the wand
func (mw *MagickWand) clearException() bool {
	return 1 == C.int(C.MagickClearException(mw.mw))
}
Example #5
0
// Returns the latest error reported by the MagickWand API.
func (self Canvas) Error() error {
	var t C.ExceptionType
	message := C.MagickGetException(self.wand, &t)
	C.MagickClearException(self.wand)
	return fmt.Errorf(C.GoString(message))
}