// newFutureError returns a new future result channel that already has the
// passed error waitin on the channel with the reply set to nil.  This is useful
// to easily return errors from the various Async functions.
428065
func newFutureError(err error) chan *response {
	responseChan := make(chan *response, 1)
	responseChan <- &response{err: err}
	return responseChan
}
1013441
func NewError(t errors.Type, m ...string) *Error {
	return &Error{
		Type:     t,
		Messages: m,
	}
}
471064
func (we *WorkflowExecutor) AddError(err error) {
	log.Errorf("executor error: %+v", err)
	we.errors = append(we.errors, err)
}
576943
func NewError(resource interface{}, column, err string) error {
	return &Error{Resource: resource, Column: column, Message: err}
}
1023099
func NewError(format string, args ...interface{}) Error {
	return Error{fmt.Sprintf(format, args...)}
}
866835
func (c *Cmd) ExpectError(err error) *Cmd {
	c.Responses = append(c.Responses, Response{nil, err})
	return c
}
1259069
func (c *AfterConnectionEstablished) Future() *promise.Future {
	p := promise.NewPromise()

	go func() {
		if err := c.Client.BlockUntilConnectedTimeout(c.Timeout); err != nil {
			p.Reject(err)
		} else {
			p.Resolve(p)
		}
	}()

	return p.Future
}
1315018
func NewError(code int, msg string) *Error {
	return &Error{
		Code:    code,
		Message: msg}
}
199144
func NewError(ctx *gin.Context, status int, err error) {
	er := HTTPError{
		Code:    status,
		Message: err.Error(),
	}
	ctx.JSON(status, er)
}
544427
func NewError(e error, p Position) Error {
	return &err{error: e, _position: p}
}
1366021
func NewMutateErrorResponse(key string, err error) MutateResponse {
	resp := &genericResponse{
		err: err,
	}
	resp.item.Key = key
	return resp
}
1312876
func New(completer Completer, timeout time.Duration) *Future {
	f := &Future{}
	f.wg.Add(1)
	var wg sync.WaitGroup
	wg.Add(1)
	go listenForResult(f, completer, timeout, &wg)
	wg.Wait()
	return f
}
1100311
func (ctx *BatchedContext) FirstError() error {
	for i, v := range ctx.results {
		if cuResult(v) != Success {
			return result(v)
		}
		ctx.results[i] = C.CUDA_SUCCESS
	}
	return nil
}
671157
func NewExitError(message interface{}, exitCode int) *ExitError {
	return &ExitError{
		exitCode: exitCode,
		message:  message,
	}
}
278050
func NewApiError(code int, msg string) *Error {
	return &Error{
		apiError: &apiError{
			code: code,
			msg:  msg,
		},
		Err: nil,
	}
}
41762
func NewBatchError(code, message string, errs []error) BatchedErrors {
	return newBaseError(code, message, errs)
}
561701
func NewRPCError(code RPCErrorCode, message string) *RPCError {
	return &RPCError{
		Code:    code,
		Message: message,
	}
}