Catching errors from <call-service>

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Catching errors from <call-service>

jonwimp
Is it possible to catch errors from <call-service>, and putting out our own "more user-friendly"
error message?

Perhaps there could be an option in <call-service>, say 'propagate-error="true"' that will throw
the called service's error out to the caller?

By the way, I've managed to mute any non-user-friendly "success message" from a <call-service>.
See below for example. Am I doing it right?

<call-service service-name="someService" in-map-name="someServiceParams"/>
<!-- Note that a <check-errors/> inside "someService" will stop us dead right at above line. -->
<clear-field field-name="successMessage"/>
<add-error>
     <fail-message message="Deliberate error, rolling back all updates."/>
</add-error>
<if-not-empty field-name="error_list">
     <clear-field field-name="error_list"/>
     <string-to-list string="Our own user-friendly error message." list-name="error_list"/>
</if-not-empty>
<check-errors/>

Without the <clear-field> line, a generic success message "The action was performed successfully"
will appear, such that we'll see:

The Following Errors Occurred:

     * Our own user-friendly error message.


The Following Occurred:

     * The action was performed successfully.

Jonathon