mod to throw exception in  extracting hostname method