From eff583aa6566f8a87ef5cb1a87dd96a4fa26dc76 Mon Sep 17 00:00:00 2001 From: Camden Phalen Date: Tue, 14 Jan 2025 17:29:21 -0500 Subject: [PATCH] Add new error messages --- lang/en.lyaml | 3 +++ lib/localDev.ts | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lang/en.lyaml b/lang/en.lyaml index 8634c9de2..d42ebc22b 100644 --- a/lang/en.lyaml +++ b/lang/en.lyaml @@ -1075,6 +1075,7 @@ en: fileChangeError: "Failed to notify local dev server of file change: {{ message }}" localDev: confirmDefaultAccountIsTarget: + configError: "An error occurred while reading the default account from your config. Run {{ authCommand }} to re-auth this account" declineDefaultAccountExplanation: "To develop on a different account, run {{ useCommand }} to change your default account, then re-run {{ devCommand }}." checkIfDefaultAccountIsSupported: publicApp: "This project contains a public app. Local development of public apps is only supported on developer accounts and developer test accounts. Change your default account using {{ useCommand }}, or link a new account with {{ authCommand }}." @@ -1095,6 +1096,7 @@ en: createInitialBuildForNewProject: initialUploadMessage: "HubSpot Local Dev Server Startup" projectLockedError: "Your project is locked. This may mean that another user is running the {{#bold}}`hs project watch`{{/bold}} command for this project. If this is you, unlock the project in Projects UI." + genericError: "An error occurred while creating the initial build for this project. Run {{ uploadCommand }} to try again." checkIfParentAccountIsAuthed: notAuthedError: "To develop this project locally, run {{ authCommand }} to authenticate the App Developer Account {{ accountId }} associated with {{ accountIdentifier }}." projects: @@ -1421,6 +1423,7 @@ en: invalidUser: "Couldn't create {{#bold}}{{ accountName }}{{/bold}} because your account has been removed from {{#bold}}{{ parentAccountName }}{{/bold}} or your permission set doesn't allow you to create the sandbox. To update your permissions, contact a super admin in {{#bold}}{{ parentAccountName }}{{/bold}}." 403Gating: "Couldn't create {{#bold}}{{ accountName }}{{/bold}} because {{#bold}}{{ parentAccountName }}{{/bold}} does not have access to development sandboxes. To opt in to the CRM Development Beta and use development sandboxes, visit https://app.hubspot.com/l/product-updates/in-beta?update=13899236." usageLimitsFetch: "Unable to fetch sandbox usage limits. Please try again." + generic: "An error occurred while creating a new sandbox. Please try again." limit: developer: one: "{{#bold}}{{ accountName }}{{/bold}} reached the limit of {{ limit }} development sandbox. diff --git a/lib/localDev.ts b/lib/localDev.ts index e8e0130b4..76fe50088 100644 --- a/lib/localDev.ts +++ b/lib/localDev.ts @@ -64,7 +64,12 @@ export async function confirmDefaultAccountIsTarget( accountConfig: CLIAccount ): Promise { if (!accountConfig.name || !accountConfig.accountType) { - throw new Error('TODO'); + logger.error( + i18n(`${i18nKey}.confirmDefaultAccountIsTarget.configError`, { + authCommand: uiCommandReference('hs auth'), + }) + ); + process.exit(EXIT_CODES.ERROR); } logger.log(); @@ -245,7 +250,7 @@ export async function createSandboxForLocalDev( const sandboxAccountConfig = getAccountConfig(result.sandbox.sandboxHubId); if (!sandboxAccountConfig) { - logger.error('TODO'); + logger.error(i18n('lib.sandbox.create.failure.generic')); process.exit(EXIT_CODES.ERROR); } @@ -443,7 +448,12 @@ function projectUploadCallback( buildId?: number ): Promise { if (!buildId) { - throw new Error('TODO'); + logger.error( + i18n(`${i18nKey}.createInitialBuildForNewProject.initialUploadMessage`, { + uploadCommand: uiCommandReference('hs project upload'), + }) + ); + process.exit(EXIT_CODES.ERROR); } return pollProjectBuildAndDeploy(