HTTPConnector handling of error status codes

Hi,

When using the HTTPConnector in Clover 4 to POST to a web service, I’m not seeing errors being properly routed to the error port:

16:34:11,720 WARN [HTTPCONNECTOR_5] Returned code for http request http://... is 415
16:34:11,720 INFO [HTTPCONNECTOR_5] Processing response…
16:34:11,722 INFO [HTTPCONNECTOR_5] Executed sucessfully.

What do I need to do to ensure that errors are routed to the error port?

Thanks,
Joe

Hi Joe,

Thank you for the email. HTTPConnector does have two output port. The first one is for all type of responses you can basically get - so including 401 etc. Basically anytime the Clover receives a valid response with appropriate code it is sent to the first output port (Output mapping must be defined).
The second output port is used for other sort of exceptions - e.g. when a host is unavailable (produces unknowHostException). This is to handle unexpected situations when you want to keep the graph running (sometime you might only want to fail the graph a “controlled way” and this might be the way you can do it).

Regarding the warning, could you please provide us with the graph (or at least the execution log) so the we can see see the particular warning?

Should you have any further questions please do not hesitate to contact us.

My solution is to attach Condition component to output port 0 and set Condition property to “$in.0.statusCode >= 200 and $in.0.statusCode < 300” to eval real result. The task I repeat for every HTTPConnector usage and consider to encapsulate this to build a subgraph (after upgrade to v4).

It would be nice to have such property to override HTTPConnector to this befaviour by default. Now literally any server response is considered success, which sadly is hardly true.

Martin

Hi Martin,

As there is already an issue in our bug tracker (CLO-1710) for this property, I just voted there for you to raise it’s priority.