// ReportError records a DSL error for reporting post DSL execution.
4679
func ReportError(fm string, vals ...interface{}) {
	var suffix string
	if cur := ctxStack.Current(); cur != nil {
		if ctx := cur.Context(); ctx != "" {
			suffix = fmt.Sprintf(" in %s", ctx)
		}
	} else {
		suffix = " (top level)"
	}
	err := fmt.Errorf(fm+suffix, vals...)
	file, line := computeErrorLocation()
	Errors = append(Errors, &Error{
		GoError: err,
		File:    file,
		Line:    line,
	})
}
286119
func (m *Mux) UseError(fn c.HandlerFunc) *Mux {
	m.Middleware.UseError(fn)
	return m
}
514200
func (r *RenderTemplateResult) renderError(err error, req *Request, resp *Response) {
	compileError, found := err.(*Error)
	if !found {
		var templateContent []string
		templateName, line, description := ParseTemplateError(err)
		if templateName == "" {
			templateLog.Info("Cannot determine template name to render error", "error", err)
			templateName = r.Template.Name()
			templateContent = r.Template.Content()

		} else {
			lang, _ := r.ViewArgs[CurrentLocaleViewArg].(string)
			if tmpl, err := MainTemplateLoader.TemplateLang(templateName, lang); err == nil {
				templateContent = tmpl.Content()
			} else {
				templateLog.Info("Unable to retreive template ", "error", err)
			}
		}
		compileError = &Error{
			Title:       "Template Execution Error",
			Path:        templateName,
			Description: description,
			Line:        line,
			SourceLines: templateContent,
		}
	}
	resp.Status = 500
	resultsLog.Errorf("render: Template Execution Error (in %s): %s", compileError.Path, compileError.Description)
	ErrorResult{r.ViewArgs, compileError}.Apply(req, resp)
}
1222222
func logError(source, format string, v ...interface{}) {
	errLogger.Printf(fmt.Sprintf("[ERROR] %s %s", source, format), v...)
}
426432
func (e ServerError) Error() string {
	if e.Err != nil {
		return e.Err.Error()
	}
	return "ServerError"
}
71967
func ResponseError(format string, a ...interface{}) {
	response := ErrorResponse{Error: fmt.Sprintf(format, a...)}
	j, err := json.MarshalIndent(&response, "", "\t")
	if err != nil {
		panic(fmt.Sprintf("Failed to generate response for error:", err))
	}
	fmt.Println(string(j[:]))
}
586052
func (s *ReportStatus) Error() error {
	if s.UnpackStatus != ok {
		return fmt.Errorf("unpack error: %s", s.UnpackStatus)
	}

	for _, s := range s.CommandStatuses {
		if err := s.Error(); err != nil {
			return err
		}
	}

	return nil
}
452024
func (d *decodeState) saveError(err error) {
	if d.savedError == nil {
		d.savedError = err
	}
}
145337
func (v *Result) AddError(err ResultError, details ErrorDetails) {
	if _, exists := details["context"]; !exists && err.Context() != nil {
		details["context"] = err.Context().String()
	}

	err.SetDescription(formatErrorDescription(err.DescriptionFormat(), details))

	v.errors = append(v.errors, err)
}
81604
func (d *ulReqDecoder) error(format string, a ...interface{}) {
	msg := fmt.Sprintf(
		"pkt-line %d: %s", d.nLine,
		fmt.Sprintf(format, a...),
	)

	d.err = NewErrUnexpectedData(msg, d.line)
}
692892
func WriteError(w http.ResponseWriter, code int, err string) {
	w.WriteHeader(code)

	WriteJSON(w, map[string]string{
		"error": err,
	})
}
382676
func (m URLs) WithError(err *probe.Error) URLs {
	m.Error = err
	return m
}
324375
func (d *Decoder) syntaxError(msg string) error {
	return &SyntaxError{Msg: msg, Line: d.line}
}
165364
func WithError(msg string, err error) {
	p := problem.FromError(err)
	if p != nil {
		WithProblem(msg, p)
	}
	displayError(msg, err)
	os.Exit(Software)
}
1022745
func printError(err error) {
	// Do nothing is the error is errCmdArgsParse.
	if err == errCmdArgsParse {
		return
	}

	fmt.Fprintln(os.Stderr, err)

	// Print the help of the GMQ Client commands if the error is errInvalidCmdName.
	if err == errInvalidCmdName {
		fmt.Println()
		printHelp()
	}
}
658758
func (errs *Errors) AddError(errors ...error) {
	for _, err := range errors {
		if err != nil {
			if e, ok := err.(errorsInterface); ok {
				errs.errors = append(errs.errors, e.GetErrors()...)
			} else {
				errs.errors = append(errs.errors, err)
			}
		}
	}
}
846306
func FormatError(err error) []byte {
	jsonError, ok := err.(*jsonmessage.JSONError)
	if !ok {
		jsonError = &jsonmessage.JSONError{Message: err.Error()}
	}
	if b, err := json.Marshal(&jsonmessage.JSONMessage{Error: jsonError, ErrorMessage: err.Error()}); err == nil {
		return appendNewline(b)
	}
	return []byte(`{"error":"format error"}` + streamNewline)
}