Example #1
0
func GetLastError() string {
	err := C.virGetLastError()
	errMsg := fmt.Sprintf("[Code-%d] [Domain-%d] %s",
		err.code, err.domain, C.GoString(err.message))
	C.virResetError(err)
	return errMsg
}
Example #2
0
// LastError provides a pointer to the last error caught at the library level.
// The error object is kept in thread local storage, so separate threads can
// safely access this concurrently.
func LastError() *Error {
	cError := C.virGetLastError()
	if cError == nil {
		log.Println("LastError() did not return an error")
	}

	return NewError(cError)
}
Example #3
0
func GetLastError() VirError {
	err := C.virGetLastError()
	if err == nil {
		return ErrNoError
	}
	virErr := newError(err)
	C.virResetError(err)
	return virErr
}
Example #4
0
func GetLastError() VirError {
	var virErr VirError
	err := C.virGetLastError()

	virErr.Code = int(err.code)
	virErr.Domain = int(err.domain)
	virErr.Message = C.GoString(err.message)
	virErr.Level = int(err.level)

	C.virResetError(err)
	return virErr
}
Example #5
0
func GetLastError() *LibvirtError {
	err := C.virGetLastError()
	defer C.virResetError(err)

	return newLibvirtError(err)
}