-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #714 from NHSDigital/release
V4.25.0 Release
- Loading branch information
Showing
11 changed files
with
161 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<ExtractVariables async="false" continueOnError="false" enabled="true" name="ExtractVariables.ErrorDetails"> | ||
<VariablePrefix>data</VariablePrefix> | ||
<Source>error.content</Source> | ||
<JSONPayload> | ||
<Variable name="errors" type="string"> | ||
<JSONPath>$.errors</JSONPath> | ||
</Variable> | ||
</JSONPayload> | ||
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> | ||
</ExtractVariables> |
2 changes: 1 addition & 1 deletion
2
...ExtractVariables.NhsAppAccounts.Error.xml → ...olicies/ExtractVariables.ErrorMessage.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
|
||
<Javascript async="false" continueOnError="false" enabled="true" timeLimit="200" name="JavaScript.EnhanceErrorDetails"> | ||
<DisplayName>JavaScript.EnhanceErrorDetails</DisplayName> | ||
<Properties/> | ||
<ResourceURL>jsc://EnhanceErrorDetails.js</ResourceURL> | ||
</Javascript> |
22 changes: 22 additions & 0 deletions
22
proxies/shared/policies/RaiseFault.GenericErrorDetails.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
|
||
<!-- | ||
Generic error response format. The errors are taken from data.enhancedErrors. Note the status code and reason phrase are not set but | ||
derived from the target response. | ||
--> | ||
|
||
<RaiseFault async="false" continueOnError="false" enabled="true" name="RaiseFault.GenericErrorDetails"> | ||
<DisplayName>RaiseFault.GenericErrorDetails</DisplayName> | ||
<Properties/> | ||
<FaultResponse> | ||
<Set> | ||
<Headers/> | ||
<Payload variablePrefix="%" variableSuffix="#"> | ||
{ | ||
"errors" : %data.enhancedErrors# | ||
} | ||
</Payload> | ||
</Set> | ||
</FaultResponse> | ||
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> | ||
</RaiseFault> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const errors = context.getVariable('data.errors'); | ||
const messageId = context.getVariable('messageid'); | ||
const statusCode = context.getVariable('response.status.code'); | ||
const links = { | ||
about : "{{ ERROR_ABOUT_LINK }}" | ||
}; | ||
|
||
const enhancedErrors = []; | ||
|
||
JSON.parse(errors).forEach((error, index) => { | ||
var code = 'CM_INVALID_VALUE'; | ||
if (error.title === 'Missing value') { | ||
code = 'CM_MISSING_VALUE'; | ||
} | ||
|
||
enhancedErrors.push({ | ||
id: messageId + '.' + index, | ||
code: code, | ||
links: links, | ||
status: statusCode, | ||
title: error.title, | ||
detail: error.message, | ||
source: { | ||
pointer: error.field | ||
} | ||
}); | ||
}); | ||
|
||
context.setVariable("data.enhancedErrors", JSON.stringify(enhancedErrors)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters