Better exception handling for url opening.