// makeError returns a err-formed data.
760424
func makeError(t string, errCode int, errMsg string) map[string]interface{} {
	return map[string]interface{}{
		"t": t,
		"y": "e",
		"e": []interface{}{errCode, errMsg},
	}
}
1364532
func MakeWrapError(g *GlobalContext) func(e error) interface{} {
	return func(e error) interface{} {
		return ExportErrorAsStatus(g, e)
	}
}
919224
func MakeError(err error) *Error {
	if err == nil {
		return nil
	}

	return &Error{
		GrpcCode:  int32(grpcutil.Code(err)),
		Transient: transient.Tag.In(err),
	}
}
94535
func (r *RequestError) Error() error {
	if r.Message != "" {
		return errors.New(r.Message)
	}

	return nil
}
241318
func (v *Validator) AddError(field string, msg string) *ValidationResult {
	result := &ValidationResult{
		field:   field,
		message: msg,
	}
	v.results = append(v.results, result)
	return result
}
470817
func (ec *ErrorCollection) AddError(err error) {
	ec.lock.Lock()
	defer ec.lock.Unlock()

	ec.addError(err)
}
280429
func (r *Response) SetError(id string, description string) {
	r.SetErrorUri(id, description, "", "")
}
198444
func (d *Document) AddError(newErr *Error) *Error {

	if d.HasData() {
		return ISE("Attempting to set an error, when the document has prepared response data")
	}

	if newErr.Status == 0 {
		return ISE("No HTTP Status code provided for error, cannot add to document")
	}

	if d.Status == 0 {
		d.Status = newErr.Status
	}

	if d.Errors == nil {
		d.Errors = []*Error{newErr}
	} else {
		d.Errors = append(d.Errors, newErr)
	}

	// set document to error mode
	d.Mode = ErrorMode

	return nil
}
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)
			}
		}
	}
}
793715
func appendError(errors []error, err error) []error {
	if err != nil {
		return append(errors, err)
	}
	return errors
}
329958
func (errs Errors) Error() string {
	var errors = []string{}
	for _, e := range errs {
		errors = append(errors, e.Error())
	}
	return strings.Join(errors, "; ")
}
446054
func (self Otto) MakeSyntaxError(message string) Value {
	return self.runtime.toValue(self.runtime.newSyntaxError(self.runtime.toValue(message)))
}
1007843
func MakeErrorHandler(hfcn http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		// catch errors
		defer func() {
			if err, ok := recover().(error); ok {
				w.WriteHeader(http.StatusInternalServerError)
				fmt.Fprintf(w, "INTERNAL ERROR (dmp): 500 HTTP error:\n%v", err)
			}
		}()
		// call the wrapped handler
		hfcn(w, r)
	}
}
845322
func (ne NestedError) Error() string {
	return ne.Err.Error() + ": " + ne.NestedErr.Error()
}
535251
func (f *Factory) SetError(err error) {
	f.mu.Lock()
	defer f.mu.Unlock()

	f.err = err
	if err != nil {
		for _, node := range f.cells {
			node.PropagateWatchError(err)
		}
	}
}
817168
func Flatten(err error) error {
	// If it isn't an *Error, just return the error as-is
	if _, ok := err.(*Error); !ok {
		return err
	}

	// Otherwise, make the result and flatten away!
	flatErr := new(Error)
	flatten(err, flatErr)
	return flatErr
}
109112
func (errs forwardErrors) Error() string {
	// Only print 10 errors
	strsLen := len(errs)
	if len(errs) > 10 {
		strsLen = 10
	}

	// convert the errors into a slice of strings
	strs := make([]string, strsLen)
	for i, err := range errs[:len(strs)] {
		strs[i] = err.Error()
	}

	// If there are errors that weren't printed, add a message to the end
	str := strings.Join(strs, "\n * ")
	if len(strs) < len(errs) {
		str += fmt.Sprintf("\nand %d more...", len(errs)-len(strs))
	}

	return str
}