// Wraps any error as a Exception
500349
func AsException(err error) *Exception {
	if err == nil {
		return nil
	}
	switch e := err.(type) {
	case *Exception:
		return e
	case CodedError:
		return NewException(e.ErrorCode(), e.String())
	default:
		return NewException(ErrorCodeGeneric, err.Error())
	}
}
294150
func (p *pageState) wrapError(err error) error {

	var filename string
	if !p.File().IsZero() {
		filename = p.File().Filename()
	}

	err, _ = herrors.WithFileContextForFile(
		err,
		filename,
		filename,
		p.s.SourceSpec.Fs.Source,
		herrors.SimpleLineMatcher)

	return err
}
5439
func (err *ErrClose) Error() string {
	if len(err.Errs) == 1 {
		return err.Errs[0].Error()
	}

	var buf bytes.Buffer

	fmt.Fprintf(&buf, "The following kites failed to close:\n\n")

	for i, e := range err.Errs {
		if e == nil {
			continue
		}

		fmt.Fprintf(&buf, "\t[%d] %s\n", i, e)
	}

	return buf.String()
}
648938
func (err HandlerError) Error() string {
	return fmt.Sprintf("%s in:\n%s", err.Err.Error(), err.Stack)
}
803274
func Error(v ...interface{}) {
	std.Fprint(std.flags, LEVEL_ERROR, 2, fmt.Sprint(v...), nil)
}
268507
func (defaultErrorHandler) HandleError(err error, w http.ResponseWriter, req *http.Request) {
	w.WriteHeader(http.StatusInternalServerError)
	fmt.Fprintf(w, "Error: %s", err)
}
329958
func (errs Errors) Error() string {
	var errors = []string{}
	for _, e := range errs {
		errors = append(errors, e.Error())
	}
	return strings.Join(errors, "; ")
}
277731
func (v *LengthRule) Error(message string) *LengthRule {
	v.message = message
	return v
}
1211463
func (e Errors) Error() string {
	ret := ""
	if len(e) > 0 {
		ret = fmt.Sprintf("Errors:\n")
		ret += strings.Join(e, "\n")
	}
	return ret
}
799163
func (e *Error) Error() string {
	var ret string
	ret = e.desc + "\n"

	// TODO: use github.com/pkg/errors
	for _, stack := range e.stack {
		ret += fmt.Sprintf("%s [%s %d]\n", stack.fun, stack.file, stack.line)
	}
	return ret
}
1214000
func (self ErrorList) Error() string {
	switch len(self) {
	case 0:
		return "no errors"
	case 1:
		return self[0].Error()
	}
	return fmt.Sprintf("%s (and %d more errors)", self[0].Error(), len(self)-1)
}
43862
func Wrap(err error, message ...string) Error {
	var ctx context
	return ctx.Wrap(err, message...)
}
139927
func (e *ErrorObject) Error() string {
	return fmt.Sprintf("Error: %s %s\n", e.Title, e.Detail)
}
1033291
func (cl *Call) Error(arguments ...interface{}) {
	cl.scope.log(cl.entry, fmt.Sprintln(arguments...))
	cl.scope.t.Fail()
}
421534
func (app *Application) handleError(ctx *Context, statusCode int, data ...map[string]interface{}) {
	ctx.SendStatus(statusCode)
	handler, ok := app.errorHandler[statusCode]
	if !ok {
		defaultErrorHandler(ctx, data...)
		return
	}
	handler(ctx)
}
713923
func (r Error) Error() string {
	s := "["
	for i, err := range r.ErrSet {
		if i != 0 {
			s = s + "; "
		}
		s = s + err.Error()
	}
	return s + "]"
}
1181094
func Error(v ...interface{}) {
	if Severity >= LevelError {
		std.Output(5, fmt.Sprint(v...), LevelError)
	}
}