Properly handle errors and enable http logging