/// <summary> /// Returns an error response based on the submitted beans and exception /// </summary> /// <param name="subscription"> /// The subscription. /// </param> /// <param name="schemaVersion"> /// - the version of the schema to output the response in /// </param> /// <param name="th"> /// - the error /// </param> /// <returns> /// The <see cref="XTypedElement"/>. /// </returns> public virtual XTypedElement BuildErrorResponse( ISubscriptionObject subscription, SdmxSchemaEnumType schemaVersion, Exception th) { switch (schemaVersion) { case SdmxSchemaEnumType.VersionTwoPointOne: return this._v21Builder.BuildErrorResponse(subscription, th); default: throw new SdmxNotImplementedException( ExceptionCode.Unsupported, "Submit Subscitpion response in version" + schemaVersion); } }
/// <summary> /// Builds the error response. /// </summary> /// <param name="notification"> /// The notification. /// </param> /// <param name="exception"> /// The exception. /// </param> /// <returns> /// The <see cref="RegistryInterface"/>. /// </returns> public RegistryInterface BuildErrorResponse(ISubscriptionObject notification, Exception exception) { var responseType = new RegistryInterface(); RegistryInterfaceType regInterface = responseType.Content; V21Helper.Header = regInterface; var returnType = new SubmitSubscriptionsResponseType(); regInterface.SubmitSubscriptionsResponse = returnType; var subscriptionStatus = new SubscriptionStatusType(); returnType.SubscriptionStatus.Add(subscriptionStatus); if (notification != null) { subscriptionStatus.SubscriptionURN = notification.Urn; } var statusMessageType = new StatusMessageType(); subscriptionStatus.StatusMessage = statusMessageType; this.AddStatus(statusMessageType, exception); return responseType; }