From d37d7f3b516ef1b491953a16009f1bf5f73825a7 Mon Sep 17 00:00:00 2001 From: Zach Leventer Date: Fri, 24 Apr 2026 10:27:53 -0400 Subject: [PATCH] fix: add missing throw before messages.createError() calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two locations create an SfError but silently discard it instead of throwing, so error conditions are swallowed and execution continues: - deploy/cancel.ts:88 — when the deployment is already in a terminal state (Canceled/Failed/Succeeded), the guard creates the error but never throws it, allowing the cancel attempt to proceed on a finished job - convertBehavior.ts:63 — when getPackageDirectoriesForPreset finds no matching component sets, the error is created and dropped; the function returns an empty array instead of surfacing the failure to the caller --- src/commands/project/deploy/cancel.ts | 2 +- src/utils/convertBehavior.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/project/deploy/cancel.ts b/src/commands/project/deploy/cancel.ts index 2485ccf1..cef35fe4 100644 --- a/src/commands/project/deploy/cancel.ts +++ b/src/commands/project/deploy/cancel.ts @@ -85,7 +85,7 @@ export default class DeployMetadataCancel extends SfCommand { deployOpts.status ) ) { - messages.createError('error.CannotCancelDeployPre', [jobId, deployOpts.status]); + throw messages.createError('error.CannotCancelDeployPre', [jobId, deployOpts.status]); } if (flags.async) { diff --git a/src/utils/convertBehavior.ts b/src/utils/convertBehavior.ts index 0c69c2c7..7f39dd16 100644 --- a/src/utils/convertBehavior.ts +++ b/src/utils/convertBehavior.ts @@ -60,7 +60,7 @@ export const getPackageDirectoriesForPreset = async ( ) ).filter(componentSetIsNonEmpty); if (output.length === 0) { - messages.createError('error.noTargetTypes', [preset]); + throw messages.createError('error.noTargetTypes', [preset]); } return output;