Add support for custom exception classes