// NewError example
199144
func NewError(ctx *gin.Context, status int, err error) {
	er := HTTPError{
		Code:    status,
		Message: err.Error(),
	}
	ctx.JSON(status, er)
}
544427
func NewError(e error, p Position) Error {
	return &err{error: e, _position: p}
}
785872
func NewError(err error) *Error {
	e := &Error{}
	if err != nil {
		e.Store(err)
	}
	return e
}
851139
func NewError(msg string, p *position.Position) *Error {
	return &Error{
		Msg: msg,
		Pos: p,
	}
}
81135
func NewError(code ErrorCode, str string, fatal bool) (err Error) {
	return Error{code, str, fatal}
}
944368
func NewError(statuscode int, msg string) *Error {
	return &Error{StatusCode: statuscode, Message: msg}
}
92940
func NewCLIError(msg string, args ...interface{}) error {
	return CommandLineError{fmt.Errorf(msg, args...)}
}
257904
func newErrorBox(err error, code int, msgs Messages, args ...interface{}) *errorBox {
	return &errorBox{
		err:  err,
		code: code,
		msg:  msgs.Format(code, args...),
		info: retrieveCallInfo(),
	}
}
1209408
func NewHTTPError(resp *http.Response) *HTTPError {
	var e HTTPError
	e.StatusCode = resp.StatusCode

	if resp.Body == nil {
		return &e
	}

	// If this is a jsonapi response, decode it accordingly
	if resp.Header.Get("Content-Type") == jsonapi.MediaType {
		if err := decodeJSON(&e, resp.Body); err != nil {
			panic(err)
		}
	} else {
		var lerr *legacyError
		decodeJSON(&lerr, resp.Body)
		if lerr != nil {
			e.Errors = append(e.Errors, &ErrorObject{
				Title:  lerr.Message,
				Detail: lerr.Detail,
			})
		}
	}

	return &e
}
466787
func NewHTTPError(err error, msg string, status int) HTTPError {
	return HTTPError{err: err, msg: msg, status: status}
}
1292818
func NewErrorObjectNotFound(e error, o string) ErrorObjectNotFound {
	return ErrorObjectNotFound{err: e, obj: o}
}
907418
func NewError(source, title,path,description string) *Error {
	return &Error {
		SourceType:source,
		Title:title,
		Path:path,
		Description:description,
	}
}
23391
func NewQuietError(req *http.Request, code int32, e error) error {
	return errors.Wrap(&Error{
		silent:   true,
		redirect: false,
		source:   req.URL.String(),
		request:  req,
		err:      newAPIError(code, errString(e)),
	}, 1)
}
23970
func NewHTTPError(code int, message ...interface{}) *HTTPError {
	he := &HTTPError{Code: code, Message: http.StatusText(code)}
	if len(message) > 0 {
		he.Message = message[0]
	}
	return he
}
1013441
func NewError(t errors.Type, m ...string) *Error {
	return &Error{
		Type:     t,
		Messages: m,
	}
}
594325
func NewError(errcode C.int) error {
	if errcode == C.MPV_ERROR_SUCCESS {
		return nil
	}
	return Error(errcode)
}
1042004
func NewErrorV1(code, f string, a ...interface{}) *ErrorV1 {
	return &ErrorV1{
		Code:    code,
		Message: fmt.Sprintf(f, a...),
	}
}