From 842939968f91d40ffd79da6377123c8db4125e39 Mon Sep 17 00:00:00 2001 From: "posthog-eu[bot]" <226701856+posthog-eu[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 20:48:14 +0000 Subject: [PATCH] fix(cli): throw CliUserError from bundle zip expected failures The five expected user-configuration aborts in `cli/src/bundle/zip.ts` threw bare `Error`, so `shouldCapturePosthogException` still opened an error tracking `$exception` issue for each. Swap them to `CliUserError`, the same marker `bundle upload` already uses through `uploadFail`, so the telemetry skips these deliberate stops. Messages, exit codes, and the existing analytics events stay unchanged. Generated-By: PostHog Code Task-Id: 07a4bba7-a89a-4f63-a64b-e1253273dd2d --- cli/src/bundle/zip.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cli/src/bundle/zip.ts b/cli/src/bundle/zip.ts index 84ef4e904c..5a8d6e7667 100644 --- a/cli/src/bundle/zip.ts +++ b/cli/src/bundle/zip.ts @@ -7,6 +7,7 @@ import { parse } from '@std/semver' import { trackEvent } from '../analytics/track' import { checkAlerts } from '../api/update' import { getChecksum } from '../checksum' +import { CliUserError } from '../shared/cli-user-error' import { baseKeyV2, findRoot, @@ -62,7 +63,7 @@ export async function zipBundleInternal(appId: string, options: BundleZipOptions else log.error(message) } - throw new Error('Invalid bundle version format') + throw new CliUserError('Invalid bundle version format') } path = path || extConfig?.config?.webDir @@ -75,7 +76,7 @@ export async function zipBundleInternal(appId: string, options: BundleZipOptions else log.error(message) } - throw new Error(message) + throw new CliUserError(message) } if (shouldShowPrompts) @@ -92,7 +93,7 @@ export async function zipBundleInternal(appId: string, options: BundleZipOptions else log.error('notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready') } - throw new Error('notifyAppReady() is missing in build folder') + throw new CliUserError('notifyAppReady() is missing in build folder') } const foundIndex = checkIndexPosition(path) @@ -103,7 +104,7 @@ export async function zipBundleInternal(appId: string, options: BundleZipOptions else log.error(`index.html is missing in the root folder of ${path}`) } - throw new Error('index.html is missing in root folder') + throw new CliUserError('index.html is missing in root folder') } } @@ -123,7 +124,7 @@ export async function zipBundleInternal(appId: string, options: BundleZipOptions const warning = 'Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager' if (!silent) log.warn(warning) - throw new Error(warning) + throw new CliUserError(warning) } let useSha256 = false