 					routeObj.properties = responseObj.properties
 					routeObj.response = responseObj.response
 				else
-					routeObj.response = response					
+					routeObj.response = response
 
 				ctx.routes = [] if not ctx.routes
 				ctx.routes.push routeObj
 			.fail (reason) ->
 				# on failure
-				logger.error reason
+				handleServerError ctx, reason
 
 		promises.push promise
 

	client.on 'data', (chunk) ->
		bufs.push chunk
		
	client.on 'error', (err) ->
		response.status = status.INTERNAL_SERVER_ERROR
		response.timestamp = new Date()
		logger.error err
		defered.reject err

	client.on 'end', ->
		response.body = Buffer.concat bufs

		for p_key,p_val of c_vals
			ctx.cookies.set p_key,p_val,c_opts

handleServerError = (ctx, err) ->
	ctx.response.status = status.INTERNAL_SERVER_ERROR
	ctx.response.timestamp = new Date()
	ctx.response.body = "An internal server error occurred"
	logger.error err

sendRequestToRoutes = (ctx, routes, next) ->
	promises = []

