Debug
During testing, there may be implementation errors or processing errors based on data imperfections or other issues caused by environment and configuration settings. Identifying error conditions is critical and can help you implement a more robust solution.
Use the following techniques to effectively capture and handle errors early to debug the integration:
• Execution Options:
• Set the Execution Options to Treat as Error to expose the data quality conditions. If these errors occur repeatedly, you must use a script in the relevant target fields to handle the records that is causing the errors.
• Logging Options:
• Error types to log property - Select all the error types to increase debugging information. Make sure to limit the types of messages to log during production runs.
• Flush log to disk after each message - Select this option to capture error messages that may be omitted from the log for serious errors. Make sure to disable this option for production runs because it impacts performance.
• Transformation Maps:
• LogMessage function: Use this function to write custom messages to the log file to track anything quickly. In the Description parameter, include the event from where the message is logged.
• ErrorFound event: Event is raised when an error occurs during map execution. Use this event to execute a LogMessage script.
• TraceOn action: This action is available for single mode transformation maps and logs detailed information for every record that is mapped to the target. The TraceOff action stops logging these details. It is recommended to use these actions only during design time.
• Expression results: Page through records manually and view the expression results column on the Mapping tab to view real-time expression results.
• Processes:
• Break after error count: During the design session, it is convenient to run the process each time there is a change. Set the Break After Error count to a number that allows processing to continue as you design and debug the changes. Make sure to change it back to 0 before you deploy the integration.
• Decision step: One of the most common and important use of this step is for error handling. Each step in a process is represented in the Script Editor and has properties to test a condition. You must use the ReturnCode property and test for 0, which is a successful return.
When used for error handling, it is recommended to call a separate process that performs all necessary operations. This way you can reuse one process for error handling by calling it from many processes. The process can perform operations such as add a table entry with the error, archive the original source file, send email notifications, and so on.
• Script Steps: Make sure to use error handlers in the script steps in processes. In most cases, a relatively simple LogMessage() function call can be used to trap most errors and make sure that good troubleshooting information is written to the execution log file. A good example of the use of an error handler in a Process script step shows how to deal with problems when using the Studio API invoker (formerly known as the REST invoker):
On Error GoTo errHandler
Option Explicit
Dim i
'Set HTTP headers for API call
srcMsg.Properties("H.Accept") = "text/xml"
srcMsg.Properties("H.Content-Type") = "text/xml;charset=UTF-8"
srcMsg.Properties("H.Connection") = "Keep-Alive"
'Log source message properties
LogMessage("DEBUG","--------- Source Message Properties ---------")
LogMessage("DEBUG","--------- Source Message Name: " & srcMsg.Name)
LogMessage("DEBUG","--------- Source Message Encoding: " & srcMsg.Encoding)
For i = 0 to srcMsg.PropertiesCount - 1
LogMessage("DEBUG","--------- Source Message Properties: " & srcMsg.PropertyNames(i) & " = " & srcMsg.Properties(i) )
Next i
Return
errHandler:
LogMessage("ERROR", "Err.Number: " & Err.Number & " Err.Description: " & Err.Description & " Err.Line: " & Err.Line & " Err.Source: " & Err.Source & " Err.StackTrace: " & Err.StackTrace)
Last modified date: 10/22/2024