Error handling functions

Version 3
    Share This:

    << Other Best Practices

    Introduction

    Error handling functionality was introduced in version 7.1 of the AR System platform, and gives you a lot of control over message feedback to the user.

     

    The most important thing from a programmers standpoint is probably that you can actually allow transactions causing an error to continue to the database, but customizing user feedback is also very important.

     

    One other interesting thing, is that you can create generic error handlers to give users better error messages, within a single filter. Instead of having to produce a number of filters to first search, then give error, or continue with the desired operations.

     

    What better way than to give you an example, where we try to avoid the One or more entries matched filter conditions error and replacing it wit a customized error message that makes sense to the end user.

     

    First you create a two display-only-fields, that you can just copy/paste to any form where you need this functionality:

    ErrorHandlerFields.png

    When you have this in place, you can continue to create your generic error handler filters, which you can attach to any form to handle very different operations. In this example, I have created two filters:

    ErrorHandlerFilter.png

    In this example, I have two error handler filter:

    • One gives the custom message and an Error. We do not change the way things work, except giving the user a more meaningful message.
    • The second hidden filter gives a Warning instead, and allows the transaction to continue. The user will still get the meaningful message though. The filter is identical to the one shown except for the message type Warning instead of Error.
    • You could also create additional handlers to completely suppress errors.

     

    Finally, you must add your handlers to a filter that may give an Error. In this case a Push-Fields filter that may give you an ARERR 8029 Any Match error.

     

    In addition to enabling the error handler, and pointing it to one of our generic filters, you have to specify the ARERR to catch, 8029, and the customized error message text.

    ErrorHandlerEnable.png

    A caveat when doing error handlers for push-fields filters, is that the error may be thrown in a later filter Phase, and your customized 'errorhandler text' may have been overwritten by another filter...

     

    Please add comments, and I will extend and refine this document.