Enhances error handling.