For better compatibility, use Exception as the type hint