Exception handling in HTTP requests