Esempio n. 1
0
        /// <summary>
        /// Builds an object of type  <see cref="SoapException"/>
        /// </summary>
        /// <param name="buildFrom">
        /// An Object to build the output object from
        /// </param>
        /// <param name="uri">
        /// The URI.
        /// </param>
        /// <returns>
        /// Object of type <see cref="SoapException"/>
        /// </returns>
        /// <exception cref="T:Org.Sdmxsource.Sdmx.Api.Exception.SdmxException">
        /// - If anything goes wrong during the build process
        /// </exception>
        public SoapException Build(SdmxException buildFrom, string uri)
        {
            _log.ErrorFormat("SdmxError : {0}, code : {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode);
            _log.Error(buildFrom.FullMessage, buildFrom);
            if (buildFrom.SdmxErrorCode.EnumType.IsClientError())
            {
                var errorMessage = string.Format("{0}: {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.Message);
                return(SoapFaultFactory.CreateSoapException(uri, string.Empty, errorMessage, SdmxV20Errors.ErrorNumberClient, uri, true, Resources.ErrorClientMessage));
            }

            return(SoapFaultFactory.CreateSoapException(uri, string.Empty, Resources.ErrorInternalError, SdmxV20Errors.ErrorNumberServer, uri, false, buildFrom.SdmxErrorCode.ErrorString));
        }
Esempio n. 2
0
        /// <summary>
        /// Builds an object of type  <see cref="SoapException"/>
        /// </summary>
        /// <param name="buildFrom">
        /// An Object to build the output object from
        /// </param>
        /// <param name="uri">
        /// The URI.
        /// </param>
        /// <returns>
        /// Object of type <see cref="SoapException"/>
        /// </returns>
        /// <exception cref="T:Org.Sdmxsource.Sdmx.Api.Exception.SdmxException">
        /// - If anything goes wrong during the build process
        /// </exception>
        public SoapException Build(Exception buildFrom, string uri)
        {
            var sdmxException = buildFrom.ToSdmxException();

            if (sdmxException != null)
            {
                return(this.Build(sdmxException, uri));
            }

            _log.ErrorFormat(CultureInfo.InvariantCulture, Resources.ErrorUnhandledFormat2, buildFrom.GetType(), buildFrom.Message);
            _log.Error(buildFrom.ToString());
            return(SoapFaultFactory.CreateSoapException(uri, string.Empty, Resources.ErrorInternalError, SdmxV20Errors.ErrorNumberServer, uri, false, buildFrom.Message));
        }