Handling exceptions

Added exception handlers for the URL attempts.