Skip to content

Commit

Permalink
Update debugErrorAndContext
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 committed Nov 28, 2023
1 parent 0de0746 commit 546e5b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/cli/lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,7 @@ en:
standardErrors:
errorOccurred: "Error: {{ error }}"
errorContext: "Context: {{ context }}"
errorCause: "Cause: {{ cause }}"
systemErrorOccurred: "A system error has occurred: {{ errorMessage }}"
genericErrorOccurred: "A {{ name }} has occurred."
unknownErrorOccurred: "An unknown error has occurred"
Expand Down
14 changes: 13 additions & 1 deletion packages/cli/lib/errorHandlers/standardErrors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const util = require('util');
const { HubSpotAuthError } = require('@hubspot/cli-lib/lib/models/Errors');
const { logger } = require('@hubspot/cli-lib/logger');
const { i18n } = require('../lang');
Expand Down Expand Up @@ -40,7 +41,18 @@ function debugErrorAndContext(error, context) {
} else {
logger.debug(i18n(`${i18nKey}.errorOccurred`, { error }));
}
logger.debug(i18n(`${i18nKey}.errorContext`, { context }));
if (error.cause) {
logger.debug(
i18n(`${i18nKey}.errorCause`, {
cause: util.inspect(error.cause, false, null, true),
})
);
}
logger.debug(
i18n(`${i18nKey}.errorContext`, {
context: util.inspect(context, false, null, true),
})
);
}

/**
Expand Down

0 comments on commit 546e5b9

Please sign in to comment.