def handle_exception( exception )
headers = {
'Content-type' => 'application/x-yaml',
'Accept' => 'text/xml, application/xml'
}
http = Net::HTTP.new( url.host, url.port )
data = clean_exception( exception )
response = begin
http.post( url.path, {"notice" => data}.to_yaml, headers )
rescue TimeoutError => e
DaemonKit.logger.error("Timeout while contacting the Hoptoad server.")
nil
end
case response
when Net::HTTPSuccess then
DaemonKit.logger.info "Hoptoad Success: #{response.class}"
else
DaemonKit.logger.error "Hoptoad Failure: #{response.class}\n#{response.body if response.respond_to? :body}"
end
end