func Error(excpTypeId int) string {
	tgDbError := CreateExceptionByType(excpTypeId)
	if tgDbError != nil {
		return tgDbError.Error()
	}
	return tgDbError.Error()
}
///////////////////////////////////////////////////////////////
Implement functions from Interface ==> error
///////////////////////////////////////////////////////////////
package impl
import (
	"fmt"
	"tgdb"
)
const (
	TGErrorBadVerb = iota
	TGErrorInvalidMessageLength
	TGErrorBadMagic
	TGErrorProtocolNotSupported
	TGErrorBadAuthentication
	TGErrorIOException
	TGErrorConnectionTimeout
	TGErrorGeneralException
	TGErrorRetryIOException
	TGErrorChannelDisconnected
	TGErrorSecurityException
	TGErrorTransactionException
	TGErrorTypeCoercionNotSupported
	TGErrorTypeNotSupported
	TGErrorVersionMismatchException
	TGErrorInvalidErrorCode
	TGSuccess
	TGQryError
    TGQryProviderNotInitialized
    TGQryParsingError
    TGQryStepNotSupported
    TGQryStepNotAllowed
    TGQryStepArgMissing
    TGQryStepArgNotSupported
    TGQryStepMissing
    TGQryNotDefined
    TGQryAttrDescNotFound
    TGQryEdgeTypeNotFound
    TGQryNodeTypeNotFound
    TGQryInternalDataMismatchError
    TGQryStepSignatureNotSupported
    TGQryInvalidDataType
)
const (
	TGQueryInvalid = iota + 8100
	TGQueryProviderNotInitialized
	TGQueryParsingError
	TGQueryStepNotSupported
	TGQueryStepNotAllowed
	TGQueryStepArgMissing
	TGQueryStepArgNotSupported
	TGQueryStepMissing
	TGQueryNotDefined
	TGQueryAttrDescNotFound
	TGQueryEdgeTypeNotFound
	TGQueryNodeTypeNotFound
	TGQueryInternalDataMismatchError
	TGQueryStepSignatureNotSupported
	TGQueryInvalidDataType
	TGQueryErrorCodeEndMarker
)
type TGDBError struct {
	ErrorCode    string
	ErrorType    int
	ErrorMsg     string
	ErrorDetails string
	ErrorServerErrorCode int
}
func (e *TGDBError) GetErrorCode() string {
	return e.ErrorCode
}
func (e *TGDBError) GetErrorType() int {
	return e.ErrorType
}
func (e *TGDBError) GetErrorMsg() string {
	return e.ErrorMsg
}
func (e *TGDBError) GetErrorDetails() string {
	return e.ErrorDetails
}
func (e *TGDBError) GetServerErrorCode() int {
	return e.ErrorServerErrorCode
}
var PreDefinedErrors = map[int]TGDBError{
	TGErrorBadVerb:                  {ErrorCode: "TGErrorBadVerb", ErrorType: TGErrorBadVerb, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorInvalidMessageLength:     {ErrorCode: "TGErrorInvalidMessageLength", ErrorType: TGErrorInvalidMessageLength, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorBadMagic:                 {ErrorCode: "TGErrorBadMagic", ErrorType: TGErrorBadMagic, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorProtocolNotSupported:     {ErrorCode: "TGErrorProtocolNotSupported", ErrorType: TGErrorProtocolNotSupported, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorBadAuthentication:        {ErrorCode: "TGErrorBadAuthentication", ErrorType: TGErrorBadAuthentication, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorIOException:              {ErrorCode: "TGErrorIOException", ErrorType: TGErrorIOException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorConnectionTimeout:        {ErrorCode: "TGErrorConnectionTimeout", ErrorType: TGErrorConnectionTimeout, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorGeneralException:         {ErrorCode: "TGErrorGeneralException", ErrorType: TGErrorGeneralException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorRetryIOException:         {ErrorCode: "TGErrorRetryIOException", ErrorType: TGErrorRetryIOException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorChannelDisconnected:      {ErrorCode: "TGErrorChannelDisconnected", ErrorType: TGErrorChannelDisconnected, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorSecurityException:        {ErrorCode: "TGErrorSecurityException", ErrorType: TGErrorSecurityException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorTransactionException:     {ErrorCode: "TGErrorTransactionException", ErrorType: TGErrorTransactionException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorTypeCoercionNotSupported: {ErrorCode: "TGErrorTypeCoercionNotSupported", ErrorType: TGErrorTypeCoercionNotSupported, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorTypeNotSupported:         {ErrorCode: "TGErrorTypeNotSupported", ErrorType: TGErrorTypeNotSupported, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorVersionMismatchException: {ErrorCode: "TGErrorVersionMismatchException", ErrorType: TGErrorVersionMismatchException, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGErrorInvalidErrorCode:         {ErrorCode: "TGErrorInvalidErrorCode", ErrorType: TGErrorInvalidErrorCode, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
	TGSuccess:                       {ErrorCode: "TGSuccess", ErrorType: TGSuccess, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1},
}
func DefaultTGDBError() *TGDBError {
	newTGDBError := TGDBError{ErrorCode: "", ErrorType: TGSuccess, ErrorMsg: "", ErrorDetails: "", ErrorServerErrorCode:-1}
	return &newTGDBError
}
func NewTGDBError(eCode string, eType int, eMsg, eDetails string) *TGDBError {
	newTGDBError := DefaultTGDBError()
	newTGDBError.ErrorCode = eCode
	newTGDBError.ErrorType = eType
	newTGDBError.ErrorMsg = eMsg
	newTGDBError.ErrorDetails = eDetails
	return newTGDBError
}
func NewTGDBErrorWithServerErrorCode(eCode string, eType int, eMsg, eDetails string, eServerErrorCode int) *TGDBError {
	newTGDBError := NewTGDBError(eCode, eType, eMsg, eDetails)
	newTGDBError.ErrorServerErrorCode = eServerErrorCode
	return newTGDBError
}
func GetPreDefinedErrors(code string) *TGDBError {
	for _, tgError := range PreDefinedErrors {
		if tgError.ErrorCode == code {
			return &tgError
		}
	}
	invalid := PreDefinedErrors[TGErrorInvalidErrorCode]
	return &invalid
}
func (e *TGDBError) Error() string {
	errMsg := fmt.Sprintf("ErrorCode: %s, ErrorType: %d, ErrorMessage: %s, ErrorDetails: %s", e.ErrorCode, e.ErrorType, e.ErrorMsg, e.ErrorDetails)
	return errMsg
}
func CreateExceptionByType(excpTypeId int) tgdb.TGError {
	inputExcpTypeId := excpTypeId
	switch inputExcpTypeId {
	case TGSuccess:
		return DefaultTGSuccess()
	case TGErrorBadAuthentication:
		return DefaultTGBadAuthentication()
	case TGErrorBadMagic:
		return DefaultTGBadMagic()
	case TGErrorBadVerb:
		return DefaultTGBadVerb()
	case TGErrorChannelDisconnected:
		return DefaultTGChannelDisconnected()
	case TGErrorConnectionTimeout:
		return DefaultTGConnectionTimeout()
	case TGErrorGeneralException:
		return DefaultTGGeneralException()
	case TGErrorInvalidMessageLength:
		return DefaultTGInvalidMessageLength()
	case TGErrorIOException:
		return DefaultTGIOException()
	case TGErrorProtocolNotSupported:
		return DefaultTGProtocolNotSupported()
	case TGErrorRetryIOException:
		return DefaultTGRetryIOException()
	case TGErrorSecurityException:
		return DefaultTGSecurityException()
	case TGErrorTransactionException:
		return DefaultTGTransactionException()
	case TGErrorTypeCoercionNotSupported:
		return DefaultTGTypeCoercionNotSupported()
	case TGErrorTypeNotSupported:
		return DefaultTGTypeNotSupported()
	case TGErrorVersionMismatchException:
		return DefaultTGVersionMismatchException()
	case TGErrorInvalidErrorCode:
		fallthrough
	default:
		return GetPreDefinedErrors("TGErrorInvalidErrorCode")
	}
	return nil
}
func GetErrorByType(excpTypeId int, errorCode, errorMsg, errorDetails string) tgdb.TGError {
	inputExcpTypeId := excpTypeId
	switch inputExcpTypeId {
	case TGSuccess:
		return NewTGSuccess(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorBadAuthentication:
		return NewTGBadAuthentication(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorBadMagic:
		return NewTGBadMagic(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorBadVerb:
		return NewTGBadVerb(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorChannelDisconnected:
		return NewTGChannelDisconnected(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorConnectionTimeout:
		return NewTGConnectionTimeout(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorGeneralException:
		return NewTGGeneralException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorInvalidMessageLength:
		return NewTGInvalidMessageLength(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorIOException:
		return NewTGIOException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorProtocolNotSupported:
		return NewTGProtocolNotSupported(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorRetryIOException:
		return NewTGRetryIOException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorSecurityException:
		return NewTGSecurityException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorTransactionException:
		return NewTGTransactionException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorTypeCoercionNotSupported:
		return NewTGTypeCoercionNotSupported(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorTypeNotSupported:
		return NewTGTypeNotSupported(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorVersionMismatchException:
		return NewTGVersionMismatchException(errorCode, excpTypeId, errorMsg, errorDetails)
	case TGErrorInvalidErrorCode:
		fallthrough
	default:
		return GetPreDefinedErrors("TGErrorInvalidErrorCode")
	}
	return nil
}
func GetErrorDetails(excpTypeId int) string {
	tgDbError := CreateExceptionByType(excpTypeId)
	if tgDbError != nil {
		return tgDbError.GetErrorDetails()
	}
	return tgDbError.GetErrorDetails()
}