Question

ETM Throwing Exceptions

  • 17 August 2023
  • 1 reply
  • 56 views

Hi all, 

I am using a ‘throw new Error’ piece of code in my ETM datamapper to force a failure when there is no record match when processing an excel file.  This allows me to append a custom message to the end of the error log dump in the email instead of using the ‘No match - Error’ on the Record to Update which just shows a generic message with no detail.  

It does what I want it to do but in the email message generated it is prefixed with the usual dump.

Two questions …

  1.  Is there a way to just show my custom message?  Or a completely different way to accomplish this.
  2. Is there a way to throw an info or warning message which will not stop processing so I can provide some additional information in the email as well.

Thanks!

T


1 reply

Userlevel 3
Badge +6
  1. When any error message is hit or thrown within a JavaScript expression, the full exception message will be displayed. In the particular case of a search not bringing back an exact match, you can change the “No Match” behaviour to “Error”.
    This will cause the record to fail if all of the searches specified for this field return no exact matches. You can also fine tune it for specific searches with the “Error if No Exact Match” checkbox:

With one of these enabled, the generated error message will be more concise. If the first method is used:
 

If the more fine grained option is used, you will get the values it failed on:

  1. There currently isn’t a way to get custom messages (Aside from throwing an exception with a custom message) into the generated feedback email. You can have custom logging which will be added to the generated import log that can be downloaded from the UI using the following in your JavaScript expressions:
    logger.warn("This is a warning message");
    logger.debug("This is a debug message");

    ​​​​​​Both the ability to have concise custom error messages and extra information displayed in generated feedback emails are usual ideas and I would recommend opening up one for each at https://community.ifs.com/ideas tagging assyst ETM.

Reply