How To: Replace Text Included in Error Templates

Overview

While implementing Custom Error Handling Sentry admins want to make changes to values returned based on the nature of the failure.  One such example is removing the remote server name from the error response: “Cannot resolve host 'www.forumsys.com'".

In the above example, while trying to connect to the remote server you will need to first resolve www.forumsys.com via DNS.  In case of a failure the error will contain www.forumsys.com.  Another error could be when a connection failure in which the error might be “Cannot connect to host 'www.forumsys.com’”.

 

Before proceeding, we recommend reviewing the KB article linked below to familiarize yourself with Custom Error Handling:

FAQ: Custom Error Handling in Forum Sentry - https://helpdesk.forumsys.com/entries/101217593

 

Example Use Case

Using the error message mentioned above, the use case is to mask the remote server name from the error “Cannot resolve host 'www.forumsys.com’”.  The modification will instead return “Cannot resolve host”.

This is the original / default error generated:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Body> 
<soap:Fault> 
<faultcode>soap:Server</faultcode> 
<faultstring xml:lang="en-US">Cannot resolve host 'www.forumsys.com'</faultstring> 
<detail> 
<fs:Detail xmlns:fs="http://www.forumsystems.com/2004/04/soap-fault-detail"> 
<fs:SystemName>TEST FAULT DETAIL ERROR fs.forumsys.com</fs:SystemName> 
<fs:User/> 
<fs:Policy>TestPolicy</fs:Policy> 
<fs:TaskList/> 
<fs:Task/> 
</fs:Detail> 
</detail> 
</soap:Fault> 
</soap:Body> 
</soap:Envelope>

This is the modified error message:

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring xml:lang="en-US">Cannot Resolve Host</faultstring>
<detail>
<fs:Detail xmlns:fs="http://www.forumsystems.com/2004/04/soap-fault-detail">
<fs:SystemName>TEST FAULT DETAIL ERROR fs.forumsys.com</fs:SystemName>
<fs:User/>
<fs:Policy>TestPolicy</fs:Policy>
<fs:TaskList/>
<fs:Task/>
</fs:Detail>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

 

Follow these steps to accomplish the above:


1. Create a Document with the entire SOAP fault error above
2. Create a Task List with the "Sample Document:" from # above
3. Apply on #2 above and click New to create a Task:
         a. select "Map Attributes to XML" for the type
         b. For "Map From:" select Constant
         c. Check "faultstring"
         d. Click Apply
         e. Go down to "Target Document Elements" and under CONSTANT put in the text you want. For example: Cannot Resolve Host
         f. Create Task List Group and add task List to it .
         g. Save
4. Go back to your Error Template and under "Task List Group:" select the above Task List Group.
5. Save

0 Comments

Article is closed for comments.