// SyntaxError converts parser error to TiDB's syntax error.
199555
func SyntaxError(err error) error {
	if err == nil {
		return nil
	}
	logutil.Logger(context.Background()).Error("syntax error", zap.Error(err))

	// If the error is already a terror with stack, pass it through.
	if errors.HasStack(err) {
		cause := errors.Cause(err)
		if _, ok := cause.(*terror.Error); ok {
			return err
		}
	}

	return parser.ErrParse.GenWithStackByArgs(syntaxErrorPrefix, err.Error())
}
950267
func (e *Error) Error() string {
	if len(e.Stderr) == 0 {
		return e.ExitError.Error()
	}
	n := bytes.IndexByte(e.Stderr, '\n')
	if n < 0 {
		return string(e.Stderr)
	}
	return string(e.Stderr[:n])
}
1077503
func (e *OptionsError) Error() string {
	return fmt.Sprintf("%s: %s", e.Option, e.Reason)
}
1279267
func (s *scanner) error(c int, context string) int {
	s.step = stateError
	s.err = &SyntaxError{"invalid character " + quoteChar(c) + " " + context, s.bytes}
	return scanError
}
802597
func (e Error) Error() string {
	if e.source == nil {
		return fmt.Sprintf("Update Error (%s)", e.TypeString())
	}
	return fmt.Sprintf("Update Error (%s): %s", e.TypeString(), e.source.Error())
}
29643
func (v *Error) Error() string {
	return fmt.Sprintf("%s: %s", v.Field, v.ErrorBody())
}
1018952
func (e translatorError) Error() string {
	if e.translator != nil {
		return "translator error (locale: " + e.translator.locale + ") - " + e.message
	}
	return "translator error - " + e.message
}
264470
func (ee *EntityErrors) Error() string {
	var str bytes.Buffer
	if _, err := io.WriteString(&str, "The following entities had warnings/errors:"); err != nil {
		// for linting, WriteString will never return error
		return "could not write errors to output buffer"
	}
	for _, err := range ee.warns {
		str.WriteByte('\n')
		if _, err := io.WriteString(&str, err.Error()); err != nil {
			// for linting, WriteString will never return error
			return "could not write errors to output buffer"
		}
	}
	return str.String()
}
1339884
func (e *Error) Error() string {
	filename := e.Pos.Filename
	if filename == "" {
		filename = "<source>"
	}
	return fmt.Sprintf("%s:%d:%d: %s", filename, e.Pos.Line, e.Pos.Column, e.Message)
}
185331
func (e *ErrMissingBracket) Error() string {
	return fmt.Sprintf("error: missing bracket '{}', in translation. locale: '%s' key: '%v' text: '%s'", e.locale, e.key, e.text)
}
985528
func (e Error) Error() string {
	return fmt.Sprintf("[%d] %s: %s", e, e.Title(), e.Description())
}
915799
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
	if h, ok := a.t.(tHelper); ok {
		h.Helper()
	}
	Error(a.t, err, msgAndArgs...)
}
845322
func (ne NestedError) Error() string {
	return ne.Err.Error() + ": " + ne.NestedErr.Error()
}
682192
func (r Response) FormatError() error {
	if len(r.body) == 0 {
		return fmt.Errorf("Error: %v", r.err)
	}
	return fmt.Errorf("%v", strings.TrimSpace(string(r.body)))
}
1061035
func (e RuleError) Error() string {
	if e.Err == nil {
		return "<nil>"
	}
	return e.Err.Error()
}
10714
func (e ReadyError) Error() string {
	return fmt.Sprintf(
		"failed waiting for instance (%s) to be ready, reason was: %s",
		e.InstanceID,
		e.StateReason,
	)
}
426432
func (e ServerError) Error() string {
	if e.Err != nil {
		return e.Err.Error()
	}
	return "ServerError"
}