Handling Erlang inets http client errors-Collection of common programming errors

I have an Erlang app which makes a large number of http calls to external sites using inets, using the code below

case http:request(get, {Url, []}, [{autoredirect, false}], []) of
{ok, {{_, Code, _}, _, Body}}->
    case Code of
    200 ->
        HandlerFn(Body);
    _ ->
        {error, io:format("~s returned HTTP ~p", [Broker, Code])}
    end;
Response -> %% block to handle unexpected responses from inets
    {error, io:format("~s returned ~p", [Broker, Response])}
end.

There is an explicit block to handle anything strange inets might return [Response]. Despite this, I still get what look like inets error reports dumped to the console [sample below]. What am I doing wrong here ? Do I need to configure some kind of inets error handler elsewhere ?

Thanks.

=ERROR REPORT==== 24-Apr-2010::06:49:47 ===
** Generic server  terminating 
** Last message in was {connect_and_send,
                           {request,#Ref,,0,http,
                               {"**********",80},
                               "*****************************",
                               [],get,
                               {http_request_h,undefined,"keep-alive",
                                   undefined,undefined,undefined,undefined,
                                   undefined,undefined,undefined,undefined,
                                   undefined,undefined,undefined,undefined,
                                   undefined,undefined,"news.bbc.co.uk",
                                   undefined,undefined,undefined,undefined,
                                   undefined,undefined,undefined,undefined,
                                   undefined,[],undefined,undefined,undefined,
                                   undefined,"0",undefined,undefined,
                                   undefined,undefined,undefined,undefined,[]},
                               {[],[]},
                               {http_options,"HTTP/1.1",infinity,false,[],
                                   undefined,false,infinity},
                               "************************************",
                               [],none,[],1272088179114,undefined,undefined}}
** When Server state == {state,
                            {request,#Ref,,0,http,
                                {"******************",80},
                                "*****************************",
                                [],get,
                                {http_request_h,undefined,"keep-alive",
                                    undefined,undefined,undefined,undefined,
                                    undefined,undefined,undefined,undefined,
                                    undefined,undefined,undefined,undefined,
                                    undefined,undefined,"news.bbc.co.uk",
                                    undefined,undefined,undefined,undefined,
                                    undefined,undefined,undefined,undefined,
                                    undefined,[],undefined,undefined,
                                    undefined,undefined,"0",undefined,
                                    undefined,undefined,undefined,undefined,
                                    undefined,[]},
                                {[],[]},
                                {http_options,"HTTP/1.1",infinity,false,[],
                                    undefined,false,infinity},
                                "****************************************",
                                [],none,[],1272088179114,undefined,undefined},
                            undefined,undefined,undefined,undefined,undefined,
                            {[],[]},
                            {[],[]},
                            undefined,[],nolimit,nolimit,
                            {options,
                                {undefined,[]},
                                0,2,5,120000,2,disabled,false,inet,default,
                                default,[]},
                            {timers,[],undefined},
                            httpc_manager,undefined}
** Reason for termination == 
** {error,{connect_failed,{#Ref,{error,nxdomain}}}}

=ERROR REPORT==== 24-Apr-2010::06:49:47 ===
HTTPC-MANAGER handler (, started) failed to connect and/or send request #Ref
   Result: {error,{connect_failed,{#Ref,{error,nxdomain}}}}

Originally posted 2013-11-09 20:02:27.