// wrapExecutionCondition wraps the execution of an AlgorandMock function and
// returns the expected value i with a nil error by default.
// AlgorandMock allows you to configure, which methods return errors or timeouts,
// configurable by SetError(...) or AlwaysReturnError. wrapExecutionCondition
// implements this behavior.
wrapExecutionCondition wraps the execution of an AlgorandMock function and
returns the expected value i with a nil error by default.
AlgorandMock allows you to configure, which methods return errors or timeouts,
configurable by SetError(...) or AlwaysReturnError. wrapExecutionCondition
implements this behavior.
// wrapExecutionCondition wraps the execution of an AlgorandMock function and // returns the expected value i with a nil error by default . // AlgorandMock allows you to configure which methods return errors or timeouts // configurable by SetError ( ... ) or AlwaysReturnError . wrapExecutionCondition // implements this behavior .
func (a *AlgorandMock) wrapExecutionCondition(i interface{}, def interface{}, f interface{}) (interface{}, error) {
	funcName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
	err := errors.New("error generated by a stub")
	if a.AlwaysReturnError {
		return def, err
	}
	if val, ok := a.ErrorFunctions[funcName]; ok {
		if val {
			return def, err
		}
	}
	return i, nil
}
func ( a * AlgorandMock ) wrapExecutionCondition ( i interface { } , def interface { } , f interface { } ) ( interface { } , error ) { funcName := runtime . FuncForPC ( reflect . ValueOf ( f ) . Pointer ( ) ) . Name ( ) err := errors . New ( " " ) if a . AlwaysReturnError { return def , err } if val , ok := a . ErrorFunctions [ funcName ] ; ok { if val { return def , err } } return i , nil }
wrapExecutionCondition wraps the execution of an AlgorandMock function and
returns the expected value i with a nil error by default.
wrapExecutionCondition wraps the execution of an AlgorandMock function and returns the expected value i with a nil error by default .