Enhances error handling