// Coded return an coded error.
504094
func Coded(code int32, msg string, detail ...string) *CodedError {
	e := &CodedError{
		Code:    code,
		Message: msg,
	}
	if len(detail) > 0 {
		e.Detail = detail[0]
	}
	return e
}
339719
func Encode(code string) (barcode.BarcodeIntCS, error) {
	var checkSum int
	if len(code) == 7 || len(code) == 12 {
		code += string(calcCheckNum(code))
		checkSum = utils.RuneToInt(calcCheckNum(code))
	} else if len(code) == 8 || len(code) == 13 {
		check := code[0 : len(code)-1]
		check += string(calcCheckNum(check))
		if check != code {
			return nil, errors.New("checksum missmatch")
		}
		checkSum = utils.RuneToInt(rune(code[len(code)-1]))
	}

	if len(code) == 8 {
		result := encodeEAN8(code)
		if result != nil {
			return utils.New1DCodeIntCheckSum(barcode.TypeEAN8, code, result, checkSum), nil
		}
	} else if len(code) == 13 {
		result := encodeEAN13(code)
		if result != nil {
			return utils.New1DCodeIntCheckSum(barcode.TypeEAN13, code, result, checkSum), nil
		}
	}
	return nil, errors.New("invalid ean code data")
}
1333769
func Encode(in []byte) (string, error) {
	return b64.StdEncoding.EncodeToString(in), nil
}
260530
func (s *PutEventsResultEntry) SetErrorCode(v string) *PutEventsResultEntry {
	s.ErrorCode = &v
	return s
}
304890
func (c *Context) Code(code int) (err error) {
	c.response.WriteHeader(code)
	return
}
384033
func NewCode(code int, msgs ...string) CodeError {
	return CodeError{Code: code, Msg: strings.Join(msgs, ",")}
}
170697
func (s *PutTargetsResultEntry) SetErrorCode(v string) *PutTargetsResultEntry {
	s.ErrorCode = &v
	return s
}
121903
func Error(errorCode ErrorCode, errorMessage string) *QuicError {
	return &QuicError{
		ErrorCode:    errorCode,
		ErrorMessage: errorMessage,
	}
}
1366329
func (s *InstanceStateChangeReason) SetCode(v string) *InstanceStateChangeReason {
	s.Code = &v
	return s
}
973051
func ErrorCode(err error) string {
	if err == nil {
		return ""
	}

	e, ok := err.(*Error)
	if !ok {
		return EInternal
	}

	if e == nil {
		return ""
	}

	if e.Code != "" {
		return e.Code
	}

	if e.Err != nil {
		return ErrorCode(e.Err)
	}

	return EInternal
}
210505
func (e *Error) Error() string {
	return fmt.Sprintf("%s: %s", e.Code.String(), e.Desc)
}
957088
func AWSErrorCode(err error) string {
	if awsError, ok := err.(awserr.Error); ok {
		return awsError.Code()
	}
	return ""
}
314103
func (err Error) WithCode(code int) *Error {
	err.Code = code
	if text := http.StatusText(code); text != "" {
		err.Err = text
	}
	return &err
}
540277
func (err ErrNoExtended) Error() string {
	return Error{Code: ErrNo(C.int(err) & ErrNoMask), ExtendedCode: err}.Error()
}
1365527
func (s *GetFunctionOutput) SetCode(v *FunctionCodeLocation) *GetFunctionOutput {
	s.Code = v
	return s
}
455592
func (e *Error) Error() string {
	buf, err := json.Marshal(e)
	if err != nil {
		msg, err := json.Marshal(err.Error())
		if err != nil {
			msg = []byte(`"` + errServerError.Message + `"`)
		}
		return fmt.Sprintf(`{"code":%d,"message":%s}`, errServerError.Code, string(msg))
	}
	return string(buf)
}
694890
func (s *Error) SetCode(v string) *Error {
	s.Code = &v
	return s
}