/// <summary>
 /// Initializes a new instance of the <see cref="SdmxSyntaxException"/> class. 
 /// Creates Exception from an exception code and some arguments
 /// </summary>
 /// <param name="code">
 /// The Exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxSyntaxException(ExceptionCode code, params object[] args)
     : base(_sdmxErrorCode, code, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxSyntaxException"/> class. 
 /// Creates Exception from an exception and an exception code
 /// </summary>
 /// <param name="exception">
 /// The exception
 /// </param>
 /// <param name="exceptionCode">
 /// The exception code
 /// </param>
 public SdmxSyntaxException(Exception exception, ExceptionCode exceptionCode)
     : base(exception, _sdmxErrorCode, exceptionCode, null)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxSyntaxException"/> class. 
 /// Creates Exception from an exception and an exception code
 /// </summary>
 /// <param name="exception">
 /// The exception
 /// </param>
 /// <param name="exceptionCode">
 /// The exception code
 /// </param>
 /// <param name="args">
 /// The args
 /// </param>
 public SdmxSyntaxException(Exception exception, ExceptionCode exceptionCode, params object[] args)
     : base(exception, _sdmxErrorCode, exceptionCode, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxException"/> class. 
 /// Initializes a new instance of the <see cref="T:System.Exception"/> class with serialized data.
 /// </summary>
 /// <param name="info">
 /// The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown. 
 /// </param>
 /// <param name="context">
 /// The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination. 
 /// </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// The <paramref name="info"/> parameter is null. 
 /// </exception>
 /// <exception cref="T:System.Runtime.Serialization.SerializationException">
 /// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0). 
 /// </exception>
 protected SdmxException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     this._errorCode = (SdmxErrorCode)info.GetValue("_errorCode", typeof(SdmxErrorCode));
     this._args = (object[])info.GetValue("_args", typeof(object[]));
     this._codeStr = info.GetString("_codeStr");
     this._code = (ExceptionCode)info.GetValue("_code", typeof(ExceptionCode));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxException"/> class. 
 /// Creates Exception from an error String and an Error code
 /// </summary>
 /// <param name="code">
 /// The exception code
 /// </param>
 public SdmxException(ExceptionCode code)
     : this(SdmxErrorCode.GetFromEnum(SdmxErrorCodeEnumType.InternalServerError), code, null)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxException"/> class. 
 /// Creates Exception from an error String and an Error code
 /// </summary>
 /// <param name="errorCode">
 /// The error code
 /// </param>
 /// <param name="code">
 /// The exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxException(SdmxErrorCode errorCode, ExceptionCode code, params object[] args)
     : this(null, errorCode, code, args)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SdmxException"/> class. 
        /// Creates Exception from an error String and an Error code
        /// </summary>
        /// <param name="nestedException">
        /// The exception
        /// </param>
        /// <param name="errorCode">
        /// The error code
        /// </param>
        /// <param name="code">
        /// The exception code
        /// </param>
        /// <param name="args">
        /// The arguments
        /// </param>
        public SdmxException(Exception nestedException, SdmxErrorCode errorCode, ExceptionCode code, params object[] args)
            : base(nestedException != null ? nestedException.Message : errorCode != null ? errorCode.ErrorString : null, nestedException)
        {
            this._exception = nestedException;
            this._errorCode = errorCode;
            this._args = args;
            if (nestedException != null)
            {
                Console.Error.WriteLine(nestedException.StackTrace);
                if (errorCode == null)
                {
                    var exception = nestedException as SdmxException;
                    if (exception != null)
                    {
                        this._errorCode = exception.SdmxErrorCode;
                    }
                }
            }
            else
            {
                Console.Error.WriteLine(this);
            }
            if (code != null)
            {
                this._code = code;
                this._codeStr = code.Code;
            }

            _log.Error("Error ", this);
        }
        /// <summary>
        /// Creates Exception from an exception, an exception code and some arguments
        /// </summary>
        /// <param name="exception">
        /// The exception
        /// </param>
        /// <param name="code">
        /// The exception code
        /// </param>
        /// <param name="args">
        /// The arguments
        /// </param>
        public SdmxServiceUnavailableException(Exception exception, ExceptionCode code, params object[] args)
            : base(exception, _sdmxErrorCode, code, args)
        {
	    }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxException"/> class. 
 /// Creates Exception from an error String and an Error code
 /// </summary>
 /// <param name="exception">
 /// The exception
 /// </param>
 /// <param name="code">
 /// The exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxException(Exception exception, ExceptionCode code, params object[] args)
     : this(exception, null, code, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxSemmanticException"/> class. 
 /// Creates Exception from an exception code and some arguments
 /// </summary>
 /// <param name="code">
 /// The exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxSemmanticException(ExceptionCode code, params object[] args)
     : base(null, _sdmxErrorCode, code, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxNotImplementedException"/> class. 
 /// Creates Exception from an Error code and some arguments
 /// </summary>
 /// <param name="code">
 /// The Exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxNotImplementedException(ExceptionCode code, params object[] args)
     : this(null, code, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxNotImplementedException"/> class. 
 /// Creates Exception from an Exception, an Exception code and some arguments
 /// </summary>
 /// <param name="exception">
 /// The exception
 /// </param>
 /// <param name="code">
 /// The exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxNotImplementedException(Exception exception, ExceptionCode code, params object[] args)
     : base(exception, _sdmxErrorCode, code, args)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SdmxUnauthorisedException"/> class. 
 /// </summary>
 /// <param name="code">
 /// The Exception code
 /// </param>
 /// <param name="args">
 /// The arguments
 /// </param>
 public SdmxUnauthorisedException(ExceptionCode code, params object[] args)
     : base(_sdmxErrorCode, code, args)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseCheckedException" /> class.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="code">The code.</param>
        /// <param name="args">The arguments.</param>
        protected BaseCheckedException(Exception exception, ExceptionCode code, object[] args)
            : base(exception != null ? exception.Message : null, exception)
        {
            this._exception = exception;
            if (exception != null)
            {
                Console.Error.WriteLine(exception.StackTrace);
            }

            // $$$ base.printStackTrace();
            if (code != null)
            {
                this._code = code;
                this._codeStr = code.Code;
            }

            this._args = args;
            Console.Out.WriteLine();
        }