func (c *RetryError) OrigError() error {
	if c.Err != nil {
		return c.Err
	}
	return c
}
OrigError returns original error (in this case this is the error itself)
package trace
import (
	"crypto/x509"
	"fmt"
	"io"
	"net"
	"net/url"
	"os"
)
func NotFound(message string, args ...interface{}) Error {
	return newTrace(&NotFoundError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type NotFoundError struct {
	Message string `json:"message"`
}
func (e *NotFoundError) IsNotFoundError() bool {
	return true
}
func (e *NotFoundError) Error() string {
	if e.Message != "" {
		return e.Message
	}
	return "object not found"
}
func (e *NotFoundError) OrigError() error {
	return e
}
func IsNotFound(err error) bool {
	err = Unwrap(err)
	_, ok := err.(interface {
		IsNotFoundError() bool
	})
	if !ok {
		return os.IsNotExist(err)
	}
	return true
}
func AlreadyExists(message string, args ...interface{}) Error {
	return newTrace(&AlreadyExistsError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type AlreadyExistsError struct {
	Message string `json:"message"`
}
func (n *AlreadyExistsError) Error() string {
	if n.Message != "" {
		return n.Message
	}
	return "object already exists"
}
func (AlreadyExistsError) IsAlreadyExistsError() bool {
	return true
}
func (e *AlreadyExistsError) OrigError() error {
	return e
}
func IsAlreadyExists(e error) bool {
	type ae interface {
		IsAlreadyExistsError() bool
	}
	_, ok := Unwrap(e).(ae)
	return ok
}
func BadParameter(message string, args ...interface{}) Error {
	return newTrace(&BadParameterError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type BadParameterError struct {
	Message string `json:"message"`
}
func (b *BadParameterError) Error() string {
	return b.Message
}
func (b *BadParameterError) OrigError() error {
	return b
}
func (b *BadParameterError) IsBadParameterError() bool {
	return true
}
func IsBadParameter(e error) bool {
	type bp interface {
		IsBadParameterError() bool
	}
	_, ok := Unwrap(e).(bp)
	return ok
}
func NotImplemented(message string, args ...interface{}) Error {
	return newTrace(&NotImplementedError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type NotImplementedError struct {
	Message string `json:"message"`
}
func (e *NotImplementedError) Error() string {
	return e.Message
}
func (e *NotImplementedError) OrigError() error {
	return e
}
func (e *NotImplementedError) IsNotImplementedError() bool {
	return true
}
func IsNotImplemented(e error) bool {
	type ni interface {
		IsNotImplementedError() bool
	}
	err, ok := Unwrap(e).(ni)
	return ok && err.IsNotImplementedError()
}
func CompareFailed(message string, args ...interface{}) Error {
	return newTrace(&CompareFailedError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type CompareFailedError struct {
	Message string `json:"message"`
}
func (e *CompareFailedError) Error() string {
	if e.Message != "" {
		return e.Message
	}
	return "compare failed"
}
func (e *CompareFailedError) OrigError() error {
	return e
}
func (e *CompareFailedError) IsCompareFailedError() bool {
	return true
}
func IsCompareFailed(e error) bool {
	type cf interface {
		IsCompareFailedError() bool
	}
	_, ok := Unwrap(e).(cf)
	return ok
}
func AccessDenied(message string, args ...interface{}) Error {
	return newTrace(&AccessDeniedError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type AccessDeniedError struct {
	Message string `json:"message"`
}
func (e *AccessDeniedError) Error() string {
	if e.Message != "" {
		return e.Message
	}
	return "access denied"
}
func (e *AccessDeniedError) IsAccessDeniedError() bool {
	return true
}
func (e *AccessDeniedError) OrigError() error {
	return e
}
func IsAccessDenied(err error) bool {
	_, ok := Unwrap(err).(interface {
		IsAccessDeniedError() bool
	})
	return ok
}
func ConvertSystemError(err error) error {
	innerError := Unwrap(err)
	if os.IsExist(innerError) {
		return newTrace(&AlreadyExistsError{
			Message: innerError.Error(),
		}, 2)
	}
	if os.IsNotExist(innerError) {
		return newTrace(&NotFoundError{
			Message: innerError.Error(),
		}, 2)
	}
	if os.IsPermission(innerError) {
		return newTrace(&AccessDeniedError{
			Message: innerError.Error(),
		}, 2)
	}
	switch realErr := innerError.(type) {
	case *net.OpError:
		return newTrace(&ConnectionProblemError{
			Err: realErr,
		}, 2)
	case *os.PathError:
		message := fmt.Sprintf("failed to execute command %v error:  %v", realErr.Path, realErr.Err)
		return newTrace(&AccessDeniedError{
			Message: message,
		}, 2)
	case x509.SystemRootsError, x509.UnknownAuthorityError:
		return newTrace(&TrustError{Err: innerError}, 2)
	}
	if _, ok := innerError.(net.Error); ok {
		return newTrace(&ConnectionProblemError{
			Err: innerError,
		}, 2)
	}
	return err
}
func ConnectionProblem(err error, message string, args ...interface{}) Error {
	return newTrace(&ConnectionProblemError{
		Message: fmt.Sprintf(message, args...),
		Err:     err,
	}, 2)
}
type ConnectionProblemError struct {
	Message string `json:"message"`
	Err     error  `json:"-"`
}
func (c *ConnectionProblemError) Error() string {
	if c.Message != "" {
		return c.Message
	}
	return UserMessage(c.Err)
}
func (c *ConnectionProblemError) IsConnectionProblemError() bool {
	return true
}
func (c *ConnectionProblemError) Unwrap() error {
	return c.Err
}
func (c *ConnectionProblemError) OrigError() error {
	if c.Err != nil {
		return c.Err
	}
	return c
}
func IsConnectionProblem(e error) bool {
	type ad interface {
		IsConnectionProblemError() bool
	}
	_, ok := Unwrap(e).(ad)
	return ok
}
func LimitExceeded(message string, args ...interface{}) Error {
	return newTrace(&LimitExceededError{
		Message: fmt.Sprintf(message, args...),
	}, 2)
}
type LimitExceededError struct {
	Message string `json:"message"`
}
func (c *LimitExceededError) Error() string {
	return c.Message
}
func (c *LimitExceededError) IsLimitExceededError() bool {
	return true
}
func (c *LimitExceededError) OrigError() error {
	return c
}
func IsLimitExceeded(e error) bool {
	type ad interface {
		IsLimitExceededError() bool
	}
	_, ok := Unwrap(e).(ad)
	return ok
}
func Trust(err error, message string, args ...interface{}) Error {
	return newTrace(&TrustError{
		Message: fmt.Sprintf(message, args...),
		Err:     err,
	}, 2)
}
type TrustError struct {
	Err     error  `json:"-"`
	Message string `json:"message"`
}
func (t *TrustError) Error() string {
	if t.Message != "" {
		return t.Message
	}
	return UserMessage(t.Err)
}
func (*TrustError) IsTrustError() bool {
	return true
}
func (t *TrustError) Unwrap() error {
	return t.Err
}
func (t *TrustError) OrigError() error {
	if t.Err != nil {
		return t.Err
	}
	return t
}
func IsTrustError(e error) bool {
	type te interface {
		IsTrustError() bool
	}
	_, ok := Unwrap(e).(te)
	return ok
}
func OAuth2(code, message string, query url.Values) Error {
	return newTrace(&OAuth2Error{
		Code:    code,
		Message: message,
		Query:   query,
	}, 2)
}
type OAuth2Error struct {
	Code    string     `json:"code"`
	Message string     `json:"message"`
	Query   url.Values `json:"query"`
}
func (o *OAuth2Error) Error() string {
	return fmt.Sprintf("OAuth2 error code=%v, message=%v", o.Code, o.Message)
}
func (o *OAuth2Error) IsOAuth2Error() bool {
	return true
}
func IsOAuth2(e error) bool {
	type oe interface {
		IsOAuth2Error() bool
	}
	_, ok := Unwrap(e).(oe)
	return ok
}
func IsEOF(e error) bool {
	return Unwrap(e) == io.EOF
}
func Retry(err error, message string, args ...interface{}) Error {
	return newTrace(&RetryError{
		Message: fmt.Sprintf(message, args...),
		Err:     err,
	}, 2)
}
type RetryError struct {
	Message string `json:"message"`
	Err     error  `json:"-"`
}
func (c *RetryError) Error() string {
	if c.Message != "" {
		return c.Message
	}
	return UserMessage(c.Err)
}
func (c *RetryError) IsRetryError() bool {
	return true
}
func (c *RetryError) Unwrap() error {
	return c.Err
}