diff --git a/CDP4Orm/CDP4Orm.csproj b/CDP4Orm/CDP4Orm.csproj index 6fac5c22..8d858445 100644 --- a/CDP4Orm/CDP4Orm.csproj +++ b/CDP4Orm/CDP4Orm.csproj @@ -80,7 +80,7 @@ - + diff --git a/CometServer/CometServer.csproj b/CometServer/CometServer.csproj index 41c61fab..05782635 100644 --- a/CometServer/CometServer.csproj +++ b/CometServer/CometServer.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/CometServer/Modules/10-25/ApiBase.cs b/CometServer/Modules/10-25/ApiBase.cs index aa29471d..3b96a7cb 100644 --- a/CometServer/Modules/10-25/ApiBase.cs +++ b/CometServer/Modules/10-25/ApiBase.cs @@ -1047,5 +1047,24 @@ protected CometTask CreateAndRegisterCometTask(Guid actor, string topContainerNa return cometTask; } + + /// + /// Adds a specific CDP error tag to an message + /// + /// The + /// The the Error tag + protected void AddErrorTagHeader(HttpResponse httpResponse, string errorTag) + { + var errorTagHeader = HttpConstants.CDPErrorTag; + + if (!httpResponse.Headers.ContainsKey(errorTagHeader)) + { + httpResponse.Headers[errorTagHeader] = errorTag; + } + else + { + httpResponse.Headers.TryAdd(errorTagHeader, errorTag); + } + } } } diff --git a/CometServer/Modules/10-25/EngineeringModelApi.cs b/CometServer/Modules/10-25/EngineeringModelApi.cs index 63057f7d..cccf4d43 100644 --- a/CometServer/Modules/10-25/EngineeringModelApi.cs +++ b/CometServer/Modules/10-25/EngineeringModelApi.cs @@ -1027,7 +1027,9 @@ protected async Task PostResponseData(PostRequestData postRequestData, string re if (!IsPostAllowedOnIterationSetup(resourceProcessor, iteration)) { - throw new Cdp4ModelValidationException($"It is not allowed to write data to a Frozen {nameof(IterationSetup)}, or its full containment tree. (#FROZEN_ITERATION)."); + this.AddErrorTagHeader(httpResponse, "#FROZEN_ITERATION"); + + throw new Cdp4ModelValidationException($"It is not allowed to write data to a Frozen {nameof(IterationSetup)}, or its full containment tree."); } credentialsService.Credentials.Iteration = iteration; diff --git a/CometServer/Services/Headers/HttpConstants.cs b/CometServer/Services/Headers/HttpConstants.cs index 0707eb62..ef54d6ad 100644 --- a/CometServer/Services/Headers/HttpConstants.cs +++ b/CometServer/Services/Headers/HttpConstants.cs @@ -84,6 +84,11 @@ public static class HttpConstants /// public static readonly string AcceptCdpVersionHeader = "Accept-CDP"; + /// + /// The header that specifies the the error tag of an http response message + /// + public static readonly string CDPErrorTag = "CDP-Error-Tag"; + /// /// The default data model version. ///