Handling X errors using exception handlers