Skip to content

Commit

Permalink
fix(src): tweak error handling debug verboseness in certain edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Jul 12, 2024
1 parent dcb4d3c commit 96ce293
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export async function discoverCommands(
) {
debug_.warn(
'a recoverable failure occurred while attempting to load configuration: %O',
`${error}`
error
);
} else {
throw error;
Expand Down Expand Up @@ -514,7 +514,7 @@ export async function discoverCommands(
} catch (error) {
debug_.error(
'an irrecoverable failure occurred while loading configuration: %O',
`${error}`
error
);

throw error;
Expand Down
16 changes: 0 additions & 16 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ export async function runProgram<
let configurationHooks: ConfigurationHooks | undefined = undefined;
let preExecutionContext: PreExecutionContext | undefined = undefined;
let successfullyHandledErrorViaConfigurationHook = false;
let alreadyDidErrorHandling = false;

try {
if (typeof args[1] === 'string' || Array.isArray(args[1])) {
Expand Down Expand Up @@ -394,21 +393,6 @@ export async function runProgram<
debug_('runProgram invocation succeeded');
return parsedArgv;
} catch (error) {
if (alreadyDidErrorHandling) {
debug_.warn(
`discarding exception from ${
preExecutionContext ? '::execute' : '::configureProgram'
} because error handling already happened: %O`,
error
);

debug_.message(
'note that seeing the above message may be a code smell. Check the documentation on CliError::dangerouslyFatal for more information'
);
}

alreadyDidErrorHandling = true;

debug_.error(
`handling irrecoverable exception from ${
preExecutionContext ? '::execute' : '::configureProgram'
Expand Down

0 comments on commit 96ce293

Please sign in to comment.