Esempio n. 1
0
// Returns the severity, reason, and description of any error that occurs
// when using other methods in this API.
func (p *PixelWand) Exception() (string, int) {
	var severity C.ExceptionType
	errPtr := C.PixelGetException(p.wand, &severity)
	C.PixelClearException(p.wand)
	err := C.GoString(errPtr)
	C.MagickRelinquishMemory(unsafe.Pointer(errPtr))
	return err, int(severity)
}
Esempio n. 2
0
// Returns the kind, reason and description of any error that occurs when using other methods in this API
func (pw *PixelWand) GetLastError() error {
	var et C.ExceptionType
	csdescription := C.PixelGetException(pw.pw, &et)
	defer C.free(unsafe.Pointer(csdescription))
	if ExceptionType(et) != EXCEPTION_UNDEFINED {
		pw.clearException()
		return &PixelWandException{ExceptionType(C.int(et)), C.GoString(csdescription)}
	}
	return nil
}