@canonry/canonry 4.165.2 → 4.166.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/assets/assets/{AuditHistoryPanel-DYBAiNCu.js → AuditHistoryPanel-CZByTZjH.js} +1 -1
  2. package/assets/assets/{BacklinksPage-p19FCIyh.js → BacklinksPage-DPsSKu1M.js} +1 -1
  3. package/assets/assets/{HistoryPage-CRSuA-J0.js → HistoryPage-9acsanzg.js} +1 -1
  4. package/assets/assets/{MeasurementPropertyPage-Bgr9VeUk.js → MeasurementPropertyPage-gIOHHJ4x.js} +1 -1
  5. package/assets/assets/ProjectPage-CTic0OFR.js +9 -0
  6. package/assets/assets/{RunRow-_RMMaLPt.js → RunRow-cuE1cBCg.js} +1 -1
  7. package/assets/assets/{RunsPage-CaDPSEfE.js → RunsPage-Bt6T2Kz2.js} +1 -1
  8. package/assets/assets/SettingsPage-ChyewFuC.js +1 -0
  9. package/assets/assets/{SiteHealthSection-Byp_Fu5K.js → SiteHealthSection-BYM32RDv.js} +3 -3
  10. package/assets/assets/{TrafficPage-BXkXNKYB.js → TrafficPage-DMpuFJua.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-CReS8q0H.js → TrafficSourceDetailPage-D4G26uyv.js} +1 -1
  12. package/assets/assets/{extract-error-message-CHW-A3AQ.js → extract-error-message-D7fD7zwP.js} +1 -1
  13. package/assets/assets/{index-CcS2bDjR.js → index-BliSumN-.js} +20 -20
  14. package/assets/assets/{react-sigma_core.esm.min-Cm0RA3Iv.js → react-sigma_core.esm.min-CmW2JaYh.js} +1 -1
  15. package/assets/index.html +1 -1
  16. package/dist/{chunk-P2CQ57UV.js → chunk-GU7T2JUB.js} +16 -0
  17. package/dist/{chunk-UVDX2Y4N.js → chunk-IUWFALUQ.js} +85 -94
  18. package/dist/{chunk-BJLIMWL2.js → chunk-KU45I42F.js} +55 -54
  19. package/dist/{chunk-J56XZGG6.js → chunk-QFMHIUV7.js} +6 -5
  20. package/dist/cli.js +29 -28
  21. package/dist/index.js +4 -4
  22. package/dist/{intelligence-service-QGBYYNWV.js → intelligence-service-KRQNQNEB.js} +2 -2
  23. package/dist/mcp.js +2 -2
  24. package/package.json +9 -9
  25. package/assets/assets/ProjectPage-D6-9qYKU.js +0 -9
  26. package/assets/assets/SettingsPage-Dcp71zcu.js +0 -1
@@ -236,6 +236,7 @@ import {
236
236
  deriveCitedUrlCandidates,
237
237
  deriveSiteHealthState,
238
238
  deriveWinnabilityClass,
239
+ describeError,
239
240
  determineAnswerMentioned,
240
241
  discoveryBucketSchema,
241
242
  discoveryHarvestDtoSchema,
@@ -583,7 +584,7 @@ import {
583
584
  wordpressSchemaDeployResultDtoSchema,
584
585
  wordpressSchemaStatusResultDtoSchema,
585
586
  wordpressStatusDtoSchema
586
- } from "./chunk-P2CQ57UV.js";
587
+ } from "./chunk-GU7T2JUB.js";
587
588
 
588
589
  // src/intelligence-service.ts
589
590
  import { eq as eq59, desc as desc26, asc as asc11, and as and47, ne as ne7, or as or13, inArray as inArray21, gte as gte14, lte as lte12 } from "drizzle-orm";
@@ -13633,7 +13634,7 @@ function assertLimits(limits) {
13633
13634
  // ../api-routes/src/measurement-service.ts
13634
13635
  var DEFAULT_DISCOVERY_URL_LIMIT = 1e4;
13635
13636
  function messageOf(error) {
13636
- return error instanceof Error ? error.message : String(error);
13637
+ return describeError(error);
13637
13638
  }
13638
13639
  async function measurementServiceRoutes(app, opts) {
13639
13640
  app.post("/projects/:name/measurement-discovery", {
@@ -16722,7 +16723,7 @@ function availableStableKey(preferred, taken) {
16722
16723
  throw validationError(`Discovery could not find a free stable key for '${preferred}'.`);
16723
16724
  }
16724
16725
  function messageOf2(error) {
16725
- return error instanceof Error ? error.message : String(error);
16726
+ return describeError(error);
16726
16727
  }
16727
16728
  async function measurementDiscoveryV2Routes(app) {
16728
16729
  app.post("/projects/:name/measurement-plan/draft/actions/import-sitemap", async (request, reply) => {
@@ -19091,7 +19092,7 @@ async function applyRoutes(app, opts) {
19091
19092
  try {
19092
19093
  cronExpr = resolvePreset(schedSpec.preset);
19093
19094
  } catch (err) {
19094
- const msg = err instanceof Error ? err.message : String(err);
19095
+ const msg = describeError(err);
19095
19096
  throw validationError(msg);
19096
19097
  }
19097
19098
  } else if (schedSpec.cron) {
@@ -35138,7 +35139,7 @@ async function scheduleRoutes(app, opts) {
35138
35139
  try {
35139
35140
  cronExpr = resolvePreset(preset);
35140
35141
  } catch (err) {
35141
- const msg = err instanceof Error ? err.message : String(err);
35142
+ const msg = describeError(err);
35142
35143
  throw validationError(msg);
35143
35144
  }
35144
35145
  } else {
@@ -37625,7 +37626,7 @@ function gscErrorToAppError(err, context) {
37625
37626
  status != null ? { upstreamStatus: status } : void 0
37626
37627
  );
37627
37628
  }
37628
- return providerError(`${context}: ${err instanceof Error ? err.message : String(err)}`);
37629
+ return providerError(`${context}: ${describeError(err)}`);
37629
37630
  }
37630
37631
  async function googleRoutes(app, opts) {
37631
37632
  if (opts.googleStateSecret === void 0) {
@@ -37759,7 +37760,7 @@ async function googleRoutes(app, opts) {
37759
37760
  try {
37760
37761
  tokens = await exchangeCode(googleClientId, googleClientSecret, code, redirectUri);
37761
37762
  } catch (err) {
37762
- const msg = err instanceof Error ? err.message : String(err);
37763
+ const msg = describeError(err);
37763
37764
  return reply.type("text/html").send(
37764
37765
  `<html><body style="font-family:system-ui;padding:40px;max-width:600px;margin:0 auto">
37765
37766
  <h2 style="color:#ef4444">Token exchange failed</h2>
@@ -38380,7 +38381,7 @@ async function googleRoutes(app, opts) {
38380
38381
  });
38381
38382
  results.push({ sitemapUrl, status: "accepted", submittedAt });
38382
38383
  } catch (err) {
38383
- results.push({ sitemapUrl, status: "error", error: err instanceof Error ? err.message : String(err) });
38384
+ results.push({ sitemapUrl, status: "error", error: describeError(err) });
38384
38385
  }
38385
38386
  }
38386
38387
  const accepted = results.filter((result) => result.status === "accepted").length;
@@ -38555,7 +38556,7 @@ async function googleRoutes(app, opts) {
38555
38556
  status: "success"
38556
38557
  });
38557
38558
  } catch (err) {
38558
- const msg = err instanceof Error ? err.message : String(err);
38559
+ const msg = describeError(err);
38559
38560
  results.push({
38560
38561
  url,
38561
38562
  type: "URL_UPDATED",
@@ -42867,7 +42868,7 @@ async function adsRoutes(app, opts) {
42867
42868
  try {
42868
42869
  account = await opts.verifyAdsAccount(parsed.data.apiKey);
42869
42870
  } catch (err) {
42870
- const message = err instanceof Error ? err.message : String(err);
42871
+ const message = describeError(err);
42871
42872
  throw validationError(`OpenAI Ads API rejected the key: ${message}`);
42872
42873
  }
42873
42874
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -44204,7 +44205,7 @@ async function bingRoutes(app, opts) {
44204
44205
  sites = await getSites(apiKey);
44205
44206
  bingLog("info", "connect.verify-key", { domain: project.canonicalDomain, siteCount: sites.length });
44206
44207
  } catch (e) {
44207
- const msg = e instanceof Error ? e.message : String(e);
44208
+ const msg = describeError(e);
44208
44209
  bingLog("error", "connect.verify-key-failed", { domain: project.canonicalDomain, error: msg });
44209
44210
  throw validationError(`Failed to verify Bing API key: ${msg}`);
44210
44211
  }
@@ -44472,7 +44473,7 @@ async function bingRoutes(app, opts) {
44472
44473
  } catch (e) {
44473
44474
  bingLog("warn", "inspect-url.crawl-issues-lookup-failed", {
44474
44475
  domain: project.canonicalDomain,
44475
- error: e instanceof Error ? e.message : String(e)
44476
+ error: describeError(e)
44476
44477
  });
44477
44478
  }
44478
44479
  }
@@ -44505,7 +44506,7 @@ async function bingRoutes(app, opts) {
44505
44506
  discoveryDate
44506
44507
  };
44507
44508
  } catch (e) {
44508
- const msg = e instanceof Error ? e.message : String(e);
44509
+ const msg = describeError(e);
44509
44510
  bingLog("error", "inspect-url.failed", { domain: project.canonicalDomain, url, error: msg });
44510
44511
  app.db.update(runs).set({ status: RunStatuses.failed, error: msg, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq42(runs.id, runId)).run();
44511
44512
  throw e;
@@ -44583,7 +44584,7 @@ async function bingRoutes(app, opts) {
44583
44584
  }
44584
44585
  bingLog("info", "index-submit.batch-ok", { domain: project.canonicalDomain, batchSize: batch.length, urls: batch });
44585
44586
  } catch (e) {
44586
- const msg = e instanceof Error ? e.message : String(e);
44587
+ const msg = describeError(e);
44587
44588
  const now = (/* @__PURE__ */ new Date()).toISOString();
44588
44589
  for (const url of batch) {
44589
44590
  results.push({ url, status: "error", submittedAt: now, error: msg });
@@ -44598,7 +44599,7 @@ async function bingRoutes(app, opts) {
44598
44599
  results.push({ url, status: "success", submittedAt: (/* @__PURE__ */ new Date()).toISOString() });
44599
44600
  bingLog("info", "index-submit.ok", { domain: project.canonicalDomain, url });
44600
44601
  } catch (e) {
44601
- const msg = e instanceof Error ? e.message : String(e);
44602
+ const msg = describeError(e);
44602
44603
  results.push({ url, status: "error", submittedAt: (/* @__PURE__ */ new Date()).toISOString(), error: msg });
44603
44604
  bingLog("error", "index-submit.failed", { domain: project.canonicalDomain, url, error: msg });
44604
44605
  }
@@ -45156,7 +45157,7 @@ function ga4ErrorToAppError(err, context) {
45156
45157
  }
45157
45158
  return providerError(`${context}: ${err.message}`);
45158
45159
  }
45159
- return providerError(`${context}: ${err instanceof Error ? err.message : String(err)}`);
45160
+ return providerError(`${context}: ${describeError(err)}`);
45160
45161
  }
45161
45162
  async function resolveGa4AccessToken(opts, projectName, canonicalDomain) {
45162
45163
  const saConn = opts.ga4CredentialStore?.getConnection(projectName);
@@ -45222,7 +45223,7 @@ async function ga4Routes(app, opts) {
45222
45223
  await verifyConnection(clientEmail, privateKey, propertyId);
45223
45224
  gaLog("info", "connect.verified.service-account", { projectId: project.id, propertyId });
45224
45225
  } catch (e) {
45225
- const msg = e instanceof Error ? e.message : String(e);
45226
+ const msg = describeError(e);
45226
45227
  gaLog("error", "connect.verify-failed", { projectId: project.id, propertyId, error: msg });
45227
45228
  throw validationError(`Failed to verify GA4 credentials: ${msg}`);
45228
45229
  }
@@ -45267,7 +45268,7 @@ async function ga4Routes(app, opts) {
45267
45268
  await verifyConnectionWithToken(accessToken, propertyId);
45268
45269
  gaLog("info", "connect.verified.oauth", { projectId: project.id, propertyId });
45269
45270
  } catch (e) {
45270
- const msg = e instanceof Error ? e.message : String(e);
45271
+ const msg = describeError(e);
45271
45272
  gaLog("error", "connect.verify-failed.oauth", { projectId: project.id, propertyId, error: msg });
45272
45273
  throw validationError(`Failed to verify GA4 access: ${msg}`);
45273
45274
  }
@@ -45553,7 +45554,7 @@ async function ga4Routes(app, opts) {
45553
45554
  const [acquisitionSettled, leadsSettled] = await measurementFetch;
45554
45555
  const measurementNow = (/* @__PURE__ */ new Date()).toISOString();
45555
45556
  const recordMeasurementFailure = (component, reason) => {
45556
- const message = reason instanceof Error ? reason.message : String(reason);
45557
+ const message = describeError(reason);
45557
45558
  gaLog("warn", "measurement.component-failed", {
45558
45559
  projectId: project.id,
45559
45560
  runId,
@@ -45567,7 +45568,7 @@ async function ga4Routes(app, opts) {
45567
45568
  projectId: project.id,
45568
45569
  runId,
45569
45570
  component,
45570
- error: stateError instanceof Error ? stateError.message : String(stateError)
45571
+ error: describeError(stateError)
45571
45572
  });
45572
45573
  }
45573
45574
  return { status: "error", days: component === "acquisition" ? acquisitionDays : leadDays, rowCount: 0, error: message };
@@ -45651,7 +45652,7 @@ async function ga4Routes(app, opts) {
45651
45652
  ...syncedComponents ? { syncedComponents } : {}
45652
45653
  };
45653
45654
  } catch (e) {
45654
- const msg = e instanceof Error ? e.message : String(e);
45655
+ const msg = describeError(e);
45655
45656
  gaLog("error", "sync.fetch-failed", { projectId: project.id, runId, error: msg });
45656
45657
  app.db.update(runs).set({ status: RunStatuses.failed, error: msg, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq44(runs.id, runId)).run();
45657
45658
  throw e;
@@ -46532,7 +46533,7 @@ async function getSiteStatus(connection, env) {
46532
46533
  authenticatedUser: userInfo
46533
46534
  };
46534
46535
  } catch (error) {
46535
- const message = error instanceof Error ? error.message : String(error);
46536
+ const message = describeError(error);
46536
46537
  return {
46537
46538
  url: site.siteUrl,
46538
46539
  reachable: false,
@@ -46813,7 +46814,7 @@ async function bulkSetSeoMeta(connection, entries, env) {
46813
46814
  return {
46814
46815
  slug: entry.slug,
46815
46816
  status: "skipped",
46816
- error: error instanceof Error ? error.message : String(error)
46817
+ error: describeError(error)
46817
46818
  };
46818
46819
  }
46819
46820
  }
@@ -46894,7 +46895,7 @@ async function deploySchema(connection, slug, schemas, env) {
46894
46895
  return {
46895
46896
  slug,
46896
46897
  status: "failed",
46897
- error: error instanceof Error ? error.message : String(error)
46898
+ error: describeError(error)
46898
46899
  };
46899
46900
  }
46900
46901
  }
@@ -47581,7 +47582,7 @@ async function wordpressRoutes(app, opts) {
47581
47582
  });
47582
47583
  steps.push({ name: "connect", status: "completed", summary: `Connected to ${url}` });
47583
47584
  } catch (err) {
47584
- const msg = err instanceof Error ? err.message : String(err);
47585
+ const msg = describeError(err);
47585
47586
  steps.push({ name: "connect", status: "failed", error: msg });
47586
47587
  return { projectName: project.name, steps };
47587
47588
  }
@@ -47597,7 +47598,7 @@ async function wordpressRoutes(app, opts) {
47597
47598
  pageUrls = pageSummaries.map((p) => p.link).filter((link) => typeof link === "string" && link.length > 0);
47598
47599
  steps.push({ name: "audit", status: "completed", summary: `${pageCount} pages audited, ${issueCount} issues` });
47599
47600
  } catch (err) {
47600
- const msg = err instanceof Error ? err.message : String(err);
47601
+ const msg = describeError(err);
47601
47602
  steps.push({ name: "audit", status: "failed", error: msg });
47602
47603
  return { projectName: project.name, steps };
47603
47604
  }
@@ -47637,7 +47638,7 @@ async function wordpressRoutes(app, opts) {
47637
47638
  });
47638
47639
  }
47639
47640
  } catch (err) {
47640
- const msg = err instanceof Error ? err.message : String(err);
47641
+ const msg = describeError(err);
47641
47642
  steps.push({ name: "set-meta", status: "failed", error: msg });
47642
47643
  return { projectName: project.name, steps };
47643
47644
  }
@@ -47663,7 +47664,7 @@ async function wordpressRoutes(app, opts) {
47663
47664
  });
47664
47665
  }
47665
47666
  } catch (err) {
47666
- const msg = err instanceof Error ? err.message : String(err);
47667
+ const msg = describeError(err);
47667
47668
  steps.push({ name: "schema-deploy", status: "failed", error: msg });
47668
47669
  return { projectName: project.name, steps };
47669
47670
  }
@@ -47695,7 +47696,7 @@ async function wordpressRoutes(app, opts) {
47695
47696
  }
47696
47697
  }
47697
47698
  } catch (err) {
47698
- const msg = err instanceof Error ? err.message : String(err);
47699
+ const msg = describeError(err);
47699
47700
  steps.push({ name: "google-submit", status: "skipped", summary: `Google not available: ${msg}` });
47700
47701
  }
47701
47702
  try {
@@ -47720,7 +47721,7 @@ async function wordpressRoutes(app, opts) {
47720
47721
  }
47721
47722
  }
47722
47723
  } catch (err) {
47723
- const msg = err instanceof Error ? err.message : String(err);
47724
+ const msg = describeError(err);
47724
47725
  steps.push({ name: "bing-submit", status: "skipped", summary: `Bing not available: ${msg}` });
47725
47726
  }
47726
47727
  }
@@ -54153,7 +54154,7 @@ async function runBackfillTask(options) {
54153
54154
  try {
54154
54155
  allEvents = await pullForBackfill();
54155
54156
  } catch (e) {
54156
- markFailed(`${pullErrorPrefix}: ${e instanceof Error ? e.message : String(e)}`);
54157
+ markFailed(`${pullErrorPrefix}: ${describeError(e)}`);
54157
54158
  return;
54158
54159
  }
54159
54160
  if (allEvents.length === 0) {
@@ -54416,7 +54417,7 @@ async function runBackfillTask(options) {
54416
54417
  });
54417
54418
  if (commitOutcome === "source-inactive") return;
54418
54419
  } catch (e) {
54419
- markFailed(`Backfill rollup write failed: ${e instanceof Error ? e.message : String(e)}`);
54420
+ markFailed(`Backfill rollup write failed: ${describeError(e)}`);
54420
54421
  }
54421
54422
  }
54422
54423
  async function trafficRoutes(app, opts) {
@@ -54625,7 +54626,7 @@ async function trafficRoutes(app, opts) {
54625
54626
  `WordPress traffic probe failed (HTTP ${e.status}): ${e.message}${e.body ? ` \u2014 ${e.body}` : ""}`
54626
54627
  );
54627
54628
  }
54628
- const msg = e instanceof Error ? e.message : String(e);
54629
+ const msg = describeError(e);
54629
54630
  throw providerError(`WordPress traffic probe failed: ${msg}`);
54630
54631
  }
54631
54632
  });
@@ -54716,7 +54717,7 @@ async function trafficRoutes(app, opts) {
54716
54717
  `Vercel traffic probe failed (HTTP ${e.status}): ${e.message}${e.body ? ` \u2014 ${e.body}` : ""}`
54717
54718
  );
54718
54719
  }
54719
- const msg = e instanceof Error ? e.message : String(e);
54720
+ const msg = describeError(e);
54720
54721
  throw providerError(`Vercel traffic probe failed: ${msg}`);
54721
54722
  }
54722
54723
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -55583,7 +55584,7 @@ async function trafficRoutes(app, opts) {
55583
55584
  try {
55584
55585
  accessToken = await resolveAccessToken2(credential);
55585
55586
  } catch (e) {
55586
- const msg = e instanceof Error ? e.message : String(e);
55587
+ const msg = describeError(e);
55587
55588
  markFailed(msg, "PROVIDER_AUTH");
55588
55589
  throw providerError(`Failed to resolve Cloud Run access token: ${msg}`);
55589
55590
  }
@@ -55602,7 +55603,7 @@ async function trafficRoutes(app, opts) {
55602
55603
  });
55603
55604
  allEvents = page.events;
55604
55605
  } catch (e) {
55605
- const msg = e instanceof Error ? e.message : String(e);
55606
+ const msg = describeError(e);
55606
55607
  markFailed(msg, "PROVIDER_PULL");
55607
55608
  throw providerError(`Cloud Run pull failed: ${msg}`);
55608
55609
  }
@@ -55626,7 +55627,7 @@ async function trafficRoutes(app, opts) {
55626
55627
  try {
55627
55628
  pinnedDispatcher = await assertWordpressTargetAllowed(credential.baseUrl);
55628
55629
  } catch (e) {
55629
- const msg = e instanceof Error ? e.message : String(e);
55630
+ const msg = describeError(e);
55630
55631
  markFailed(msg, "PROVIDER_PULL");
55631
55632
  throw e;
55632
55633
  }
@@ -55652,7 +55653,7 @@ async function trafficRoutes(app, opts) {
55652
55653
  allEvents = collected;
55653
55654
  nextCursor = cursor;
55654
55655
  } catch (e) {
55655
- const msg = e instanceof Error ? e.message : String(e);
55656
+ const msg = describeError(e);
55656
55657
  markFailed(msg, "PROVIDER_PULL");
55657
55658
  throw providerError(`WordPress pull failed: ${msg}`);
55658
55659
  } finally {
@@ -55754,7 +55755,7 @@ async function trafficRoutes(app, opts) {
55754
55755
  }
55755
55756
  allEvents = drained.events;
55756
55757
  } catch (e) {
55757
- const msg = e instanceof Error ? e.message : String(e);
55758
+ const msg = describeError(e);
55758
55759
  markFailed(msg, "PROVIDER_PULL");
55759
55760
  throw providerError(`Vercel pull failed: ${msg}`);
55760
55761
  }
@@ -56996,7 +56997,7 @@ var BING_AUTH_CHECKS = [
56996
56997
  remediation: null
56997
56998
  };
56998
56999
  } catch (err) {
56999
- const message = err instanceof Error ? err.message : String(err);
57000
+ const message = describeError(err);
57000
57001
  return {
57001
57002
  status: CheckStatuses.fail,
57002
57003
  code: "bing.auth.verification-failed",
@@ -57078,7 +57079,7 @@ var BING_AUTH_CHECKS = [
57078
57079
  remediation: null
57079
57080
  };
57080
57081
  } catch (err) {
57081
- const message = err instanceof Error ? err.message : String(err);
57082
+ const message = describeError(err);
57082
57083
  return {
57083
57084
  status: CheckStatuses.fail,
57084
57085
  code: "bing.auth.site-check-failed",
@@ -57338,7 +57339,7 @@ async function checkServiceAccount(conn) {
57338
57339
  try {
57339
57340
  await verifyConnection(conn.clientEmail, conn.privateKey, conn.propertyId);
57340
57341
  } catch (err) {
57341
- const message = err instanceof Error ? err.message : String(err);
57342
+ const message = describeError(err);
57342
57343
  return {
57343
57344
  status: CheckStatuses.fail,
57344
57345
  code: "ga.auth.verify-failed",
@@ -57387,7 +57388,7 @@ async function checkOAuthConnection(ctx, projectName, conn) {
57387
57388
  const tokens = await refreshAccessToken(auth.clientId, auth.clientSecret, conn.refreshToken);
57388
57389
  accessToken = tokens.access_token;
57389
57390
  } catch (err) {
57390
- const message = err instanceof Error ? err.message : String(err);
57391
+ const message = describeError(err);
57391
57392
  return {
57392
57393
  status: CheckStatuses.fail,
57393
57394
  code: "ga.auth.refresh-failed",
@@ -57399,7 +57400,7 @@ async function checkOAuthConnection(ctx, projectName, conn) {
57399
57400
  try {
57400
57401
  await verifyConnectionWithToken(accessToken, conn.propertyId);
57401
57402
  } catch (err) {
57402
- const message = err instanceof Error ? err.message : String(err);
57403
+ const message = describeError(err);
57403
57404
  return {
57404
57405
  status: CheckStatuses.fail,
57405
57406
  code: "ga.auth.verify-failed",
@@ -57518,7 +57519,7 @@ async function resolveGbpToken(ctx) {
57518
57519
  const tokens = await refreshAccessToken(auth.clientId, auth.clientSecret, conn.refreshToken);
57519
57520
  return { ok: true, token: { accessToken: tokens.access_token, conn } };
57520
57521
  } catch (err) {
57521
- const message = err instanceof Error ? err.message : String(err);
57522
+ const message = describeError(err);
57522
57523
  return {
57523
57524
  ok: false,
57524
57525
  output: {
@@ -57650,7 +57651,7 @@ var accountAccessCheck = {
57650
57651
  details: { reason: err.reason ?? void 0, status: err.status }
57651
57652
  };
57652
57653
  }
57653
- const message = err instanceof Error ? err.message : String(err);
57654
+ const message = describeError(err);
57654
57655
  return {
57655
57656
  status: CheckStatuses.fail,
57656
57657
  code: "gbp.account.list-failed",
@@ -57882,7 +57883,7 @@ async function resolveAccessToken(ctx) {
57882
57883
  const tokens = await refreshAccessToken(auth.clientId, auth.clientSecret, conn.refreshToken);
57883
57884
  return { ok: true, token: { accessToken: tokens.access_token } };
57884
57885
  } catch (err) {
57885
- const message = err instanceof Error ? err.message : String(err);
57886
+ const message = describeError(err);
57886
57887
  return {
57887
57888
  ok: false,
57888
57889
  output: {
@@ -57974,7 +57975,7 @@ var propertyAccessCheck = {
57974
57975
  details: { error: err.message }
57975
57976
  };
57976
57977
  }
57977
- const message = err instanceof Error ? err.message : String(err);
57978
+ const message = describeError(err);
57978
57979
  return {
57979
57980
  status: CheckStatuses.fail,
57980
57981
  code: "google.auth.list-sites-failed",
@@ -58561,7 +58562,7 @@ async function runValidator(source, validator, fallbackId, fallbackLabel) {
58561
58562
  }
58562
58563
  return { source, output: result };
58563
58564
  } catch (e) {
58564
- const msg = e instanceof Error ? e.message : String(e);
58565
+ const msg = describeError(e);
58565
58566
  return {
58566
58567
  source,
58567
58568
  output: {
@@ -59016,7 +59017,7 @@ var WORDPRESS_PUBLISH_CHECKS = [
59016
59017
  details: { error: err.message }
59017
59018
  };
59018
59019
  }
59019
- const message = err instanceof Error ? err.message : String(err);
59020
+ const message = describeError(err);
59020
59021
  return {
59021
59022
  status: CheckStatuses.fail,
59022
59023
  code: "wordpress.publish.verification-failed",
@@ -59076,7 +59077,7 @@ async function runChecks(ctx, checks, options = {}) {
59076
59077
  try {
59077
59078
  output = await definition.run(ctx);
59078
59079
  } catch (err) {
59079
- const message = err instanceof Error ? err.message : String(err);
59080
+ const message = describeError(err);
59080
59081
  output = {
59081
59082
  status: CheckStatuses.fail,
59082
59083
  code: `${definition.id}.runtime-error`,
@@ -62100,7 +62101,7 @@ function buildTrafficSourceValidators(opts) {
62100
62101
  summary: `Cloud Run access token resolves for "${source.displayName}" (project ${record.gcpProjectId}).`
62101
62102
  };
62102
62103
  } catch (e) {
62103
- const msg = e instanceof Error ? e.message : String(e);
62104
+ const msg = describeError(e);
62104
62105
  return {
62105
62106
  status: CheckStatuses.fail,
62106
62107
  code: "traffic.credentials.resolve-failed",
@@ -62146,7 +62147,7 @@ function buildTrafficSourceValidators(opts) {
62146
62147
  };
62147
62148
  } catch (e) {
62148
62149
  const httpStatus = e instanceof WordpressTrafficApiError ? e.status : null;
62149
- const msg = e instanceof Error ? e.message : String(e);
62150
+ const msg = describeError(e);
62150
62151
  return {
62151
62152
  status: CheckStatuses.fail,
62152
62153
  code: httpStatus === 401 || httpStatus === 403 ? "traffic.credentials.unauthorized" : "traffic.credentials.resolve-failed",
@@ -62193,7 +62194,7 @@ function buildTrafficSourceValidators(opts) {
62193
62194
  };
62194
62195
  } catch (e) {
62195
62196
  const httpStatus = e instanceof VercelLogsApiError ? e.status : null;
62196
- const msg = e instanceof Error ? e.message : String(e);
62197
+ const msg = describeError(e);
62197
62198
  return {
62198
62199
  status: CheckStatuses.fail,
62199
62200
  code: httpStatus === 401 || httpStatus === 403 ? "traffic.credentials.unauthorized" : "traffic.credentials.resolve-failed",
@@ -17,6 +17,7 @@ import {
17
17
  adsUnresolvedOperationListQuerySchema,
18
18
  backlinkSourceSchema,
19
19
  competitorBatchRequestSchema,
20
+ describeError,
20
21
  discoveryBucketSchema,
21
22
  discoveryCompetitorTypeSchema,
22
23
  discoveryPromoteRequestSchema,
@@ -81,7 +82,7 @@ import {
81
82
  trafficConnectWordpressRequestSchema,
82
83
  trafficEventKindSchema,
83
84
  trafficSeriesGranularitySchema
84
- } from "./chunk-P2CQ57UV.js";
85
+ } from "./chunk-GU7T2JUB.js";
85
86
 
86
87
  // src/config.ts
87
88
  import fs from "fs";
@@ -5271,7 +5272,7 @@ var ApiClient = class {
5271
5272
  result = await call();
5272
5273
  } catch (err) {
5273
5274
  if (err instanceof CliError) throw err;
5274
- const msg = err instanceof Error ? err.message : String(err);
5275
+ const msg = describeError(err);
5275
5276
  if (traceEnabled) {
5276
5277
  process.stderr.write(`[trace] (sdk-call) \u2192 ERROR (${Date.now() - traceStart}ms): ${msg}
5277
5278
  `);
@@ -5388,7 +5389,7 @@ var ApiClient = class {
5388
5389
  res = await fetch(url, { method: "POST", headers, body: JSON.stringify(body ?? {}), signal });
5389
5390
  } catch (err) {
5390
5391
  if (err instanceof CliError) throw err;
5391
- const msg = err instanceof Error ? err.message : String(err);
5392
+ const msg = describeError(err);
5392
5393
  if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("connect ECONNREFUSED")) {
5393
5394
  throw new CliError({
5394
5395
  code: "CONNECTION_ERROR",
@@ -5496,7 +5497,7 @@ var ApiClient = class {
5496
5497
  headers: { Authorization: `Bearer ${this.apiKey}` }
5497
5498
  });
5498
5499
  } catch (err) {
5499
- const message = err instanceof Error ? err.message : String(err);
5500
+ const message = describeError(err);
5500
5501
  if (message.includes("fetch failed") || message.includes("ECONNREFUSED") || message.includes("connect ECONNREFUSED")) {
5501
5502
  throw new CliError({
5502
5503
  code: "CONNECTION_ERROR",
@@ -8260,7 +8261,7 @@ async function submitGscSitemapsFromMcp(client2, input) {
8260
8261
  remaining,
8261
8262
  unconfirmedBatch: { index: Math.floor(offset / 50) + 1, sitemapUrls: batchSitemapUrls },
8262
8263
  partialResult: aggregate,
8263
- cause: cause instanceof CliError ? { code: cause.code, message: cause.message, details: cause.details } : { message: cause instanceof Error ? cause.message : String(cause) }
8264
+ cause: cause instanceof CliError ? { code: cause.code, message: cause.message, details: cause.details } : { message: describeError(cause) }
8264
8265
  }
8265
8266
  });
8266
8267
  }