From 847aabd0d8e85a3c862b630c20798e56e58f8caa Mon Sep 17 00:00:00 2001 From: ParthaI Date: Thu, 24 Oct 2024 20:27:38 +0530 Subject: [PATCH] Handled the NotFound error code for the chield table List API call manually --- github/table_github_package_version.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/github/table_github_package_version.go b/github/table_github_package_version.go index 1dabca7..5271008 100644 --- a/github/table_github_package_version.go +++ b/github/table_github_package_version.go @@ -3,6 +3,7 @@ package github import ( "context" "net/url" + "strings" "github.com/google/go-github/v55/github" @@ -105,7 +106,13 @@ func tableGitHubPackageVersionList(ctx context.Context, d *plugin.QueryData, h * for { packageVersions, resp, err := client.Organizations.PackageGetAllVersions(ctx, org, *pkg.PackageType, packageName, opts) if err != nil { - plugin.Logger(ctx).Error("github_package.tableGitHubPackageVersionList", "api_error", err) + // In the case of parent hydrate the ignore config seems to not work for the child table. So we need to handle it manually. + // Steampipe SDK issue ref: https://github.com/turbot/steampipe-plugin-sdk/issues/544 + if strings.Contains(err.Error(), "404") { + return nil, nil + } + + plugin.Logger(ctx).Error("github_package_version.tableGitHubPackageVersionList", "api_error", err) return nil, err } @@ -142,7 +149,7 @@ func tableGitHubPackageVersionGet(ctx context.Context, d *plugin.QueryData, h *p // Fetch the package pkgVersion, _, err := client.Organizations.PackageGetVersion(ctx, org, packageType, name, packageVersionID) if err != nil { - plugin.Logger(ctx).Error("github_package.tableGitHubPackageVersionGet", "api_error", err) + plugin.Logger(ctx).Error("github_package_version.tableGitHubPackageVersionGet", "api_error", err) return nil, err }