// EndError calls End() based on the value of err
969260
func (s *SpanStat) EndError(err error) *SpanStat {
	return s.End(err == nil)
}
846098
func (p *Parser) Err() error {
	if p.err != nil {
		return p.err
	}
	return p.r.Err()
}
473837
func (es *SubscribeToShardEventStream) Err() error {
	if err := es.Reader.Err(); err != nil {
		return err
	}
	es.StreamCloser.Close()

	return nil
}
929096
func (mw *Stats) End(start time.Time, opts ...Option) {
	options := newOptions(opts...)

	responseTime := time.Since(start)

	mw.mu.Lock()

	defer mw.mu.Unlock()

	// If Hijacked connection do not count in response time
	if options.StatusCode() != 0 {
		statusCode := fmt.Sprintf("%d", options.StatusCode())
		mw.ResponseCounts[statusCode]++
		mw.TotalResponseCounts[statusCode]++
		mw.TotalResponseTime = mw.TotalResponseTime.Add(responseTime)
		mw.TotalResponseSize += int64(options.Size())
	}
}
921240
func (e *Err) Error() string {
	if e.InnerError != nil {
		return e.InnerError.Error()
	}
	return e.Message
}
636614
func (rs *Rows) Err() error {
	if rs.lasterr == io.EOF {
		return nil
	}
	return rs.lasterr
}
1000483
func (c *Tracing) End() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.end"})
}
601867
func (p *Lexer) End() bool {
	c, err := p.Byte()

	if err != nil {
		return true
	}

	if IsEndChar(c) {
		return true
	}
	p.UnreadByte()
	return false
}
243808
func exitWhenError(err error) {
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	}
}
684640
func (l *Logger) Err(format string, v ...interface{}) {
	fmt.Fprint(l.stderr, addColor(ErrorPrefix+" ", Red))
	fmt.Fprintf(l.stderr, appendNewLine(format), v...)
}
648938
func (err HandlerError) Error() string {
	return fmt.Sprintf("%s in:\n%s", err.Err.Error(), err.Stack)
}
904088
func (err *ErrSession) Error() string {
	if err.Err == nil {
		return fmt.Sprintf("%s (%s)", stateTexts[err.State], err.Type)
	}
	return fmt.Sprintf("%s: %s (%s)", stateTexts[err.State], err.Err, err.Type)
}
416351
func (dec *Decoder) end() error {
	switch dec.curr.Kind() {
	case reflect.Struct:
		if err := dec.findStructField(); err != nil {
			return err
		}
	case reflect.Map:
		// leave backward compatibility for access to maps by .
		dec.traverseInMap(true)
	}
	return dec.decode()
}
822725
func ExitError(ctx context.Context, exitCode int, err error, format string, args ...interface{}) error {
	if err != nil {
		out.Debug(ctx, "Stacktrace: %+v", err)
	}
	return cli.NewExitError(fmt.Sprintf(format, args...), exitCode)
}
1221994
func (c *Client) end(err error, possiblyClosed bool) error {
	// close connection
	err = c.cleanup(err, true, true)

	// shutdown goroutines
	c.tomb.Kill(nil)

	// wait for all goroutines to exit
	// goroutines will send eventual errors through the callback
	c.tomb.Wait()

	// do cleanup
	return err
}
1059914
func (k *Client) EndBytes(callback ...func(response Response, body []byte, errs []error)) (Response, []byte, []error) {
	// check whether there is an error. if yes, return all errors
	if len(k.Errors) != 0 {
		return nil, nil, k.Errors
	}

	req, err := k.NewRequest()

	if err != nil {
		k.Errors = append(k.Errors, err)
		return nil, nil, k.Errors
	}

	for key, v := range k.Header {
		req.Header.Set(key, v)
	}

	// Add all querystring from Query func
	q := req.URL.Query()
	for key, v := range k.QueryData {
		for _, vv := range v {
			q.Add(key, vv)
		}
	}
	req.URL.RawQuery = q.Encode()

	// Sign Request
	if !k.Sign {
		if k.BasicAuth != struct{ UserName, Password string }{} {
			req.SetBasicAuth(k.BasicAuth.UserName, k.BasicAuth.Password)
		}
	} else {
		k.signRequest(req, time.Now())
	}

	// Set Transport
	certPool := *x509.NewCertPool()
	certPool.AppendCertsFromPEM(RootCAs.AlphaSSLCA)
	certPool.AppendCertsFromPEM(RootCAs.LetsEncryptCA)

	tr := &http.Transport{
		TLSClientConfig: &tls.Config{RootCAs: &certPool},
	}

	k.Client.Transport = tr

	// Log details of this request
	if k.Debug {
		dump, logErr := httputil.DumpRequest(req, true)
		k.check(logErr, dump)
	}

	// Send request
	resp, err := k.Client.Do(req)
	if err != nil {
		k.Errors = append(k.Errors, err)
		return nil, nil, k.Errors
	}
	defer resp.Body.Close()

	// Log details of this response
	if k.Debug {
		dump, err := httputil.DumpResponse(resp, true)
		k.check(err, dump)
	}

	body, _ := ioutil.ReadAll(resp.Body)
	// Reset resp.Body so it can be use again
	resp.Body = ioutil.NopCloser(bytes.NewBuffer(body))
	// deep copy response to give it to both return and callback func
	respCallback := *resp
	if len(callback) != 0 {
		callback[0](&respCallback, body, k.Errors)
	}
	return resp, body, nil
}
20164
func (r *responseIterator) Err() error {
	if r.response.Err != "" {
		return fmt.Errorf(r.response.Err)
	}

	return nil
}