Error Handling

The 'Populate Word Document' engine provides a configuration option named 'Population Options' which controls the behaviour of the engine. This configuration option is set to 'Default' by default.

mceclip1.png

If an error occurs during execution an exception is raised and reported:

mceclip3.png

The details of the actual error are contained within the body of the output, i.e. the information returned by the Encodian action, see below:

mceclip4.png

The error in this example states:

"A general error occurred populating the word document provided: An error has been encountered at the end of expression 'companyName>>\rFormed: '. Can not get the value of member 'Formed' on type 'System.Data.DataRow'."

The error message is stating there is an issue processing the companyName token, for this example an invalid token configuration was passed to generate the error:

mceclip5.png

Optimizing Error Handling - Solution Building

Whilst building your solution we recommend changing the Population Options' configuration option to 'InlineErrors', this instructs the population error not to throw an exception but to add the error message to the output document:

mceclip6.png

Upon processing the same request as the previous example, the flow execution will complete successfully:

mceclip7.png

On this occasion the error is added to the document itself:

mceclip8.png

On first view, the error looks to be incorrectly placed, but it is positioned where the error occurred and because the token was not closed correctly the exception was thrown on detection of the next token.

This approach to error handling can help speed up the development process.

Optimizing Error Handling - Disable Retries

Alternatively, you can also simply disable Flow's default retry policy which will automatically execute the same request 4 times before an error is thrown, see below:

1.gif

This configuration will ensure that your flow execution will fail much more quickly, allowing you to validate any errors via the errors collection returned by the Encodian action.

Execution time with the standard retry policy: Above 1 minute

mceclip9.png

Execution time with the standard retry policy disabled: 4 seconds

mceclip10.png

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk