// Creates a SyntaxError with the current line number.
324375
func (d *Decoder) syntaxError(msg string) error {
	return &SyntaxError{Msg: msg, Line: d.line}
}
713923
func (r Error) Error() string {
	s := "["
	for i, err := range r.ErrSet {
		if i != 0 {
			s = s + "; "
		}
		s = s + err.Error()
	}
	return s + "]"
}
475128
func makeError(c ErrorCode, desc string, err error) Error {
	return Error{ErrorCode: c, Description: desc, Err: err}
}
1083709
func (err readError) Error() string {
	switch err.Reason {
	case ErrBlankSectionName:
		return "empty section name not allowed"
	case ErrCouldNotParse:
		return fmt.Sprintf("could not parse line: %s", string(err.Content))
	}
	return "invalid read error"
}
75018
func NewError(code int, err error) error {
	return &Error{
		code:  code,
		error: err,
	}
}
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)
}
1242439
func (err Error) Error() string {
	switch children := err.Nested.(type) {
	case nil:
		return err.Message

	case []NestedError:
		return formatNestedError(err, children)

	default:
		return err.Message + "\n" +
			BranchDelimiter +
			strings.Replace(
				String(err.Nested),
				"\n",
				"\n"+strings.Repeat(" ", BranchIndent),
				-1,
			)
	}
}
920579
func NewError(options ...func(*Error)) *Error {
	err := &Error{}
	for _, o := range options {
		o(err)
	}

	return err
}
1121384
func MayError(code uint, err error) Error {
	if err == nil {
		return nil
	}
	return NewError(code, err)
}
537506
func makeCLIError(msg string, args ...interface{}) error {
	return commandLineError{fmt.Errorf(msg, args...)}
}
1182481
func (sc *StatementContext) AppendError(warn error) {
	sc.mu.Lock()
	if len(sc.mu.warnings) < math.MaxUint16 {
		sc.mu.warnings = append(sc.mu.warnings, SQLWarn{WarnLevelError, warn})
		sc.mu.errorCount++
	}
	sc.mu.Unlock()
}
1311732
func SyntaxWarn(err error) error {
	if err == nil {
		return nil
	}
	return parser.ErrParse.GenWithStackByArgs(syntaxErrorPrefix, err.Error())
}
555854
func MultiError(errors ...error) cli.MultiError {
	nonNilErrs := []error{}
	for _, e := range errors {
		if e != nil {
			nonNilErrs = append(nonNilErrs, e)
		}
	}

	return cli.NewMultiError(nonNilErrs...)
}
9595
func (d *Document) CurrentLineBeforeCursor() string {
	s := strings.Split(d.TextBeforeCursor(), "\n")
	return s[len(s)-1]
}
462298
func (e *Error) Error() string {
	s := "[Error"
	if e.Sender != "" {
		s += " (where: " + e.Sender + ")"
	}
	if e.Filename != "" {
		s += " in " + e.Filename
	}
	if e.Line > 0 {
		s += fmt.Sprintf(" | Line %d Col %d", e.Line, e.Column)
		if e.Token != nil {
			s += fmt.Sprintf(" near '%s'", e.Token.Val)
		}
	}
	s += "] "
	s += e.OrigError.Error()
	return s
}
165691
func (i *InvalidHtlcSigError) Error() string {
	return fmt.Sprintf("rejected commitment: commit_height=%v, "+
		"invalid_htlc_sig=%x, commit_tx=%x, sig_hash=%x", i.commitHeight,
		i.htlcSig, i.commitTx, i.sigHash[:])
}
1135898
func (err GenerationError) CodeWithLineNumbers() string {
	var buf bytes.Buffer
	scanner := bufio.NewScanner(bytes.NewReader(err.Code))
	var i int
	for scanner.Scan() {
		i++
		fmt.Fprintf(&buf, "%d: %s\n", i, scanner.Text())
	}
	return buf.String()
}