added error logging for other than 500 errors too