Reputation: 85
How to handle or log the client side error in best way. Say for Client enters the URL and he received 501 error. We need to log that error as well we need to log from which api call that error was occurred.
Can someone suggest. sorry, I cant give a example because its generic doubt in my mind
If any one suggests how to do. I will create the flow will share here for public use
Upvotes: 0
Views: 34
Reputation: 25664
You can't capture the HTTP status that the HTTP Listener sends automatically. For example a 404 (page not found), if there is no listener for that URL.
You can capture your own HTTP status that you set in your application, and do something before the flow ends.
Example:
<flow name="statusFlow" >
<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/page">
<http:response statusCode="#[vars.okStatus]" />
<http:error-response statusCode="#[vars.errorStatus]" />
</http:listener>
... set the variables ...
... log the variables ...
Note that the application can not know about status returned by something in front of your application, like a load balancer. That's the case for applications deployed to CloudHub and accessed through the load balancer.
Upvotes: 1