def METHOD_NAME(e, cmd, source_registry, source_image, registry):
    from msrestazure.azure_exceptions import ClientException
    try:
        # if command fails, it might be because user specified registry twice in --source and --registry
        if source_registry:
            if not hasattr(registry, 'login_server'):
                if is_valid_resource_id(source_registry):
                    registry, _ = get_registry_by_name(cmd.cli_ctx, parse_resource_id(source_registry)["name"])
                else:
                    registry = get_registry_from_name_or_login_server(cmd.cli_ctx, source_registry, source_registry)
            if registry.login_server.lower() in source_image.lower():
                logger.warning("Import from source failed.\n\tsource image: '%s'\n"
                               "Attention: When source registry is specified with `--registry`, "
                               "`--source` is considered to be a source image name. "
                               "Do not prefix `--source` with the registry login server name.", "{}/{}"
                               .format(registry.login_server, source_image))
    except (ClientException, CLIError) as unexpected_ex:  # raise exception
        logger.debug("Unexpected exception: %s", unexpected_ex)
    raise e  # regardless re-raise the CLIError as this is an error from the service