Question

I am trying to provide a custom message upon validation failure as oppose to the sending the stack trace to the user. It seems I am not understanding how to do this. My route is as follows:

        <route>
            <from uri="restlet:/foo"/>
            <onException>
                <exception>org.apache.camel.ValidationException</exception>
                <transform>
                    <simple>Validate your stuff</simple>
                </transform>        
                <stop/> 
          </onException>
            <validate><constant>false</constant></validate>

            <to uri="mock:result"/>
        </route>    

I tried to place the onException before or after the validation. Neither works. What I want to return to the user is 'Validate your stuff' as opposed to the complete stack trace.

Any clue?

Était-ce utile?

La solution

You could mark the exception as handled before your <transform> with:

<handled>
    <constant>true</constant>
</handled>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top