/// <summary> /// Builds an object of type <see cref="FaultException"/> /// </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="FaultException{String}"/> /// </returns> public FaultException<SdmxFault> BuildException(SdmxException buildFrom, string uri) { _log.ErrorFormat("SdmxError : {0}, code : {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode); _log.Error(buildFrom.FullMessage, buildFrom); var sdmxFault = new SdmxFault(buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode, uri); if (buildFrom.SdmxErrorCode.EnumType.IsClientError()) { return CreateExceptionClient(sdmxFault); } return CreateExceptionServer(sdmxFault); }
/// <summary> /// The create exception server. /// </summary> /// <param name="sdmxFault"> /// The sdmx fault. /// </param> /// <returns> /// The <see cref="FaultException"/>. /// </returns> private static FaultException<SdmxFault> CreateExceptionServer(SdmxFault sdmxFault) { var faultReason = new FaultReason(sdmxFault.ErrorMessage); return new FaultException<SdmxFault>(sdmxFault, faultReason, FaultCodeDefaults.Server); }
/// <summary> /// Builds an object of type <see cref="FaultException{String}"/> /// </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="FaultException{String}"/> /// </returns> public FaultException<SdmxFault> BuildException(Exception buildFrom, string uri) { var faultException = buildFrom as FaultException<SdmxFault>; if (faultException != null) { return faultException; } var webException = buildFrom as FaultException; if (webException != null) { SdmxFault fault; if (webException.Code.IsReceiverFault) { fault = new SdmxFault(_sdmxErrorCodeIntenalError.ErrorString, _sdmxErrorCodeIntenalError.ClientErrorCode, uri); return CreateExceptionServer(fault); } fault = new SdmxFault(buildFrom.Message, _sdmxErrorCodeIntenalError.ClientErrorCode, uri); return CreateExceptionClient(fault); } var sdmxException = buildFrom.ToSdmxException(); if (sdmxException != null) { return this.BuildException(sdmxException, uri); } return CreateExceptionServer(new SdmxFault(_sdmxErrorCodeIntenalError.ErrorString, _sdmxErrorCodeIntenalError.ClientErrorCode, uri)); }
/// <summary> /// Creates the exception server. /// </summary> /// <param name="sdmxFault"> /// The SDMX fault. /// </param> /// <returns> /// The <see cref="FaultException"/>. /// </returns> private FaultException<SdmxFault> CreateExceptionServer(SdmxFault sdmxFault) { return new FaultException<SdmxFault>(sdmxFault, this._faultReasonServer, FaultCodeDefaults.Server); }
/// <summary> /// Creates the exception client. /// </summary> /// <param name="sdmxFault"> /// The SDMX fault. /// </param> /// <returns> /// The <see cref="FaultException"/>. /// </returns> private FaultException<SdmxFault> CreateExceptionClient(SdmxFault sdmxFault) { return new FaultException<SdmxFault>(sdmxFault, this._clientFaultReason, FaultCodeDefaults.Client); }
/// <summary> /// Builds an object of type <see cref="FaultException{String}"/> /// </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="FaultException{String}"/> /// </returns> public FaultException<SdmxFault> BuildException(Exception buildFrom, string uri) { var faultException = buildFrom as FaultException<SdmxFault>; if (faultException != null) { return faultException; } var webException = buildFrom as FaultException; if (webException != null) { SdmxFault fault; if (webException.Code.IsReceiverFault) { fault = new SdmxFault(Resources.ErrorInternalError, _errorNumberServer, uri); return this.CreateExceptionServer(fault); } fault = new SdmxFault(buildFrom.Message, _errorNumberClient, uri); return this.CreateExceptionClient(fault); } var sdmxException = buildFrom.ToSdmxException(); if (sdmxException != null) { return this.BuildException(sdmxException, uri); } return this.CreateExceptionServer(new SdmxFault(Resources.ErrorInternalError, _errorNumberServer, uri)); }