package errorinjectors

// Code generated by gowrap. DO NOT EDIT.
// template: ../../templates/errorinjectors.tmpl
// gowrap: http://github.com/hexdigest/gowrap

import (
	"context"

	"go.uber.org/yarpc"

	"github.com/uber/cadence/client/history"
	"github.com/uber/cadence/common/errors"
	"github.com/uber/cadence/common/log"
	"github.com/uber/cadence/common/log/tag"
	"github.com/uber/cadence/common/types"
)

const (
	msgHistoryInjectedFakeErr = "Injected fake history client error"
)

// historyClient implements history.Client interface instrumented with retries
type historyClient struct {
	client        history.Client
	errorRate     float64
	logger        log.Logger
	fakeErrFn     func(float64) error
	forwardCallFn func(error) bool
}

// NewHistoryClient creates a new instance of historyClient that injects error into every call with a given rate.
func NewHistoryClient(client history.Client, errorRate float64, logger log.Logger) history.Client {
	return &historyClient{
		client:        client,
		errorRate:     errorRate,
		logger:        logger,
		fakeErrFn:     errors.GenerateFakeError,
		forwardCallFn: errors.ShouldForwardCall,
	}
}

func (c *historyClient) CloseShard(ctx context.Context, cp1 *types.CloseShardRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.CloseShard(ctx, cp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationCloseShard,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) CountDLQMessages(ctx context.Context, cp1 *types.CountDLQMessagesRequest, p1 ...yarpc.CallOption) (hp1 *types.HistoryCountDLQMessagesResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		hp1, err = c.client.CountDLQMessages(ctx, cp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationCountDLQMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) DescribeHistoryHost(ctx context.Context, dp1 *types.DescribeHistoryHostRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeHistoryHostResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		dp2, err = c.client.DescribeHistoryHost(ctx, dp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationDescribeHistoryHost,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) DescribeMutableState(ctx context.Context, dp1 *types.DescribeMutableStateRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeMutableStateResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		dp2, err = c.client.DescribeMutableState(ctx, dp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationDescribeMutableState,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) DescribeQueue(ctx context.Context, dp1 *types.DescribeQueueRequest, p1 ...yarpc.CallOption) (dp2 *types.DescribeQueueResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		dp2, err = c.client.DescribeQueue(ctx, dp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationDescribeQueue,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) DescribeWorkflowExecution(ctx context.Context, hp1 *types.HistoryDescribeWorkflowExecutionRequest, p1 ...yarpc.CallOption) (dp1 *types.DescribeWorkflowExecutionResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		dp1, err = c.client.DescribeWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationDescribeWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) GetCrossClusterTasks(ctx context.Context, gp1 *types.GetCrossClusterTasksRequest, p1 ...yarpc.CallOption) (gp2 *types.GetCrossClusterTasksResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		gp2, err = c.client.GetCrossClusterTasks(ctx, gp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationGetCrossClusterTasks,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) GetDLQReplicationMessages(ctx context.Context, gp1 *types.GetDLQReplicationMessagesRequest, p1 ...yarpc.CallOption) (gp2 *types.GetDLQReplicationMessagesResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		gp2, err = c.client.GetDLQReplicationMessages(ctx, gp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationGetDLQReplicationMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) GetFailoverInfo(ctx context.Context, gp1 *types.GetFailoverInfoRequest, p1 ...yarpc.CallOption) (gp2 *types.GetFailoverInfoResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		gp2, err = c.client.GetFailoverInfo(ctx, gp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationGetFailoverInfo,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) GetMutableState(ctx context.Context, gp1 *types.GetMutableStateRequest, p1 ...yarpc.CallOption) (gp2 *types.GetMutableStateResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		gp2, err = c.client.GetMutableState(ctx, gp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationGetMutableState,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) GetReplicationMessages(ctx context.Context, gp1 *types.GetReplicationMessagesRequest, p1 ...yarpc.CallOption) (gp2 *types.GetReplicationMessagesResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		gp2, err = c.client.GetReplicationMessages(ctx, gp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationGetReplicationMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) MergeDLQMessages(ctx context.Context, mp1 *types.MergeDLQMessagesRequest, p1 ...yarpc.CallOption) (mp2 *types.MergeDLQMessagesResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		mp2, err = c.client.MergeDLQMessages(ctx, mp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationMergeDLQMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) NotifyFailoverMarkers(ctx context.Context, np1 *types.NotifyFailoverMarkersRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.NotifyFailoverMarkers(ctx, np1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationNotifyFailoverMarkers,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) PollMutableState(ctx context.Context, pp1 *types.PollMutableStateRequest, p1 ...yarpc.CallOption) (pp2 *types.PollMutableStateResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		pp2, err = c.client.PollMutableState(ctx, pp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationPollMutableState,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) PurgeDLQMessages(ctx context.Context, pp1 *types.PurgeDLQMessagesRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.PurgeDLQMessages(ctx, pp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationPurgeDLQMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) QueryWorkflow(ctx context.Context, hp1 *types.HistoryQueryWorkflowRequest, p1 ...yarpc.CallOption) (hp2 *types.HistoryQueryWorkflowResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		hp2, err = c.client.QueryWorkflow(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationQueryWorkflow,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RatelimitUpdate(ctx context.Context, request *types.RatelimitUpdateRequest, opts ...yarpc.CallOption) (rp1 *types.RatelimitUpdateResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp1, err = c.client.RatelimitUpdate(ctx, request, opts...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRatelimitUpdate,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ReadDLQMessages(ctx context.Context, rp1 *types.ReadDLQMessagesRequest, p1 ...yarpc.CallOption) (rp2 *types.ReadDLQMessagesResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp2, err = c.client.ReadDLQMessages(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationReadDLQMessages,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ReapplyEvents(ctx context.Context, hp1 *types.HistoryReapplyEventsRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.ReapplyEvents(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationReapplyEvents,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RecordActivityTaskHeartbeat(ctx context.Context, hp1 *types.HistoryRecordActivityTaskHeartbeatRequest, p1 ...yarpc.CallOption) (rp1 *types.RecordActivityTaskHeartbeatResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp1, err = c.client.RecordActivityTaskHeartbeat(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRecordActivityTaskHeartbeat,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RecordActivityTaskStarted(ctx context.Context, rp1 *types.RecordActivityTaskStartedRequest, p1 ...yarpc.CallOption) (rp2 *types.RecordActivityTaskStartedResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp2, err = c.client.RecordActivityTaskStarted(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRecordActivityTaskStarted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RecordChildExecutionCompleted(ctx context.Context, rp1 *types.RecordChildExecutionCompletedRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RecordChildExecutionCompleted(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRecordChildExecutionCompleted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RecordDecisionTaskStarted(ctx context.Context, rp1 *types.RecordDecisionTaskStartedRequest, p1 ...yarpc.CallOption) (rp2 *types.RecordDecisionTaskStartedResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp2, err = c.client.RecordDecisionTaskStarted(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRecordDecisionTaskStarted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RefreshWorkflowTasks(ctx context.Context, hp1 *types.HistoryRefreshWorkflowTasksRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RefreshWorkflowTasks(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRefreshWorkflowTasks,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RemoveSignalMutableState(ctx context.Context, rp1 *types.RemoveSignalMutableStateRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RemoveSignalMutableState(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRemoveSignalMutableState,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RemoveTask(ctx context.Context, rp1 *types.RemoveTaskRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RemoveTask(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRemoveTask,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ReplicateEventsV2(ctx context.Context, rp1 *types.ReplicateEventsV2Request, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.ReplicateEventsV2(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationReplicateEventsV2,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RequestCancelWorkflowExecution(ctx context.Context, hp1 *types.HistoryRequestCancelWorkflowExecutionRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RequestCancelWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRequestCancelWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ResetQueue(ctx context.Context, rp1 *types.ResetQueueRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.ResetQueue(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationResetQueue,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ResetStickyTaskList(ctx context.Context, hp1 *types.HistoryResetStickyTaskListRequest, p1 ...yarpc.CallOption) (hp2 *types.HistoryResetStickyTaskListResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		hp2, err = c.client.ResetStickyTaskList(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationResetStickyTaskList,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ResetWorkflowExecution(ctx context.Context, hp1 *types.HistoryResetWorkflowExecutionRequest, p1 ...yarpc.CallOption) (rp1 *types.ResetWorkflowExecutionResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp1, err = c.client.ResetWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationResetWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondActivityTaskCanceled(ctx context.Context, hp1 *types.HistoryRespondActivityTaskCanceledRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RespondActivityTaskCanceled(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondActivityTaskCanceled,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondActivityTaskCompleted(ctx context.Context, hp1 *types.HistoryRespondActivityTaskCompletedRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RespondActivityTaskCompleted(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondActivityTaskCompleted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondActivityTaskFailed(ctx context.Context, hp1 *types.HistoryRespondActivityTaskFailedRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RespondActivityTaskFailed(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondActivityTaskFailed,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondCrossClusterTasksCompleted(ctx context.Context, rp1 *types.RespondCrossClusterTasksCompletedRequest, p1 ...yarpc.CallOption) (rp2 *types.RespondCrossClusterTasksCompletedResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		rp2, err = c.client.RespondCrossClusterTasksCompleted(ctx, rp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondCrossClusterTasksCompleted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondDecisionTaskCompleted(ctx context.Context, hp1 *types.HistoryRespondDecisionTaskCompletedRequest, p1 ...yarpc.CallOption) (hp2 *types.HistoryRespondDecisionTaskCompletedResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		hp2, err = c.client.RespondDecisionTaskCompleted(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondDecisionTaskCompleted,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) RespondDecisionTaskFailed(ctx context.Context, hp1 *types.HistoryRespondDecisionTaskFailedRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.RespondDecisionTaskFailed(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationRespondDecisionTaskFailed,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) ScheduleDecisionTask(ctx context.Context, sp1 *types.ScheduleDecisionTaskRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.ScheduleDecisionTask(ctx, sp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationScheduleDecisionTask,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) SignalWithStartWorkflowExecution(ctx context.Context, hp1 *types.HistorySignalWithStartWorkflowExecutionRequest, p1 ...yarpc.CallOption) (sp1 *types.StartWorkflowExecutionResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		sp1, err = c.client.SignalWithStartWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationSignalWithStartWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) SignalWorkflowExecution(ctx context.Context, hp1 *types.HistorySignalWorkflowExecutionRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.SignalWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationSignalWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) StartWorkflowExecution(ctx context.Context, hp1 *types.HistoryStartWorkflowExecutionRequest, p1 ...yarpc.CallOption) (sp1 *types.StartWorkflowExecutionResponse, err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		sp1, err = c.client.StartWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationStartWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) SyncActivity(ctx context.Context, sp1 *types.SyncActivityRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.SyncActivity(ctx, sp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationSyncActivity,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) SyncShardStatus(ctx context.Context, sp1 *types.SyncShardStatusRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.SyncShardStatus(ctx, sp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationSyncShardStatus,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}

func (c *historyClient) TerminateWorkflowExecution(ctx context.Context, hp1 *types.HistoryTerminateWorkflowExecutionRequest, p1 ...yarpc.CallOption) (err error) {
	fakeErr := c.fakeErrFn(c.errorRate)
	var forwardCall bool
	if forwardCall = c.forwardCallFn(fakeErr); forwardCall {
		err = c.client.TerminateWorkflowExecution(ctx, hp1, p1...)
	}

	if fakeErr != nil {
		c.logger.Error(msgHistoryInjectedFakeErr,
			tag.HistoryClientOperationTerminateWorkflowExecution,
			tag.Error(fakeErr),
			tag.Bool(forwardCall),
			tag.ClientError(err),
		)
		err = fakeErr
		return
	}
	return
}
