throw an exception for invalid URLs