Skip to content

Commit

Permalink
Fix error message lang errors
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 committed Oct 30, 2023
1 parent abaebf1 commit a19e657
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions packages/cli/lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -1267,11 +1267,11 @@ en:
standardErrors:
errorOccurred: "Error: {{ error }}"
errorContext: "Context: {{ context }}"
systemErrorOccurred: "A system error has occured: {{ errorMessage }}"
genericErrorOccured: "A {{ name }} has occurred."
unknownErrorOccured: "An unknown error has occured"
systemErrorOccurred: "A system error has occurred: {{ errorMessage }}"
genericErrorOccurred: "A {{ name }} has occurred."
unknownErrorOccurred: "An unknown error has occurred"
fileSystemErrors:
errorOccured: "An error occurred while {{ fileAction }} {{ filepath }}."
errorOccurred: "An error occurred while {{ fileAction }} {{ filepath }}."
errorExplanation: "This is the result of a system error: {{ errorMessage }}"
apiErrors:
messageDetail: "{{ request }} in account {{ accountId }}"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/errorHandlers/fileSystemErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function logFileSystemErrorInstance(error, context) {
const filepath = context.filepath
? `"${context.filepath}"`
: 'a file or folder';
const message = [i18n(`${i18nKey}.errorOccured`, { fileAction, filepath })];
const message = [i18n(`${i18nKey}.errorOccurred`, { fileAction, filepath })];
// Many `fs` errors will be `SystemError`s
if (isSystemError(error)) {
message.push(
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/lib/errorHandlers/standardErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function debugErrorAndContext(error, context) {
if (error.name === 'StatusCodeError') {
const { statusCode, message, response } = error;
logger.debug(
i18n(`${i18nKey}.errorOccured`, {
i18n(`${i18nKey}.errorOccurred`, {
error: {
statusCode,
message,
Expand All @@ -38,9 +38,9 @@ function debugErrorAndContext(error, context) {
})
);
} else {
logger.debug(i18n(`${i18nKey}.errorOccured`, { error }));
logger.debug(i18n(`${i18nKey}.errorOccurred`, { error }));
}
logger.debug(i18n(`${i18nKey}.errorContect`, { context }));
logger.debug(i18n(`${i18nKey}.errorContext`, { context }));
}

/**
Expand All @@ -51,7 +51,9 @@ function debugErrorAndContext(error, context) {
* @param {ErrorContext} context
*/
function logSystemError(error, context) {
logger.error(i18n(`${i18nKey}.systemErrorOccured`, { error: error.message }));
logger.error(
i18n(`${i18nKey}.systemErrorOccurred`, { error: error.message })
);
debugErrorAndContext(error, context);
}

Expand All @@ -70,7 +72,7 @@ function logErrorInstance(error, context) {
if (error instanceof Error || error.message || error.reason) {
// Error or Error subclass
const name = error.name || 'Error';
const message = [i18n(`${i18nKey}.genericErrorOccured`, { name })];
const message = [i18n(`${i18nKey}.genericErrorOccurred`, { name })];
[(error.message, error.reason)].forEach(msg => {
if (msg) {
message.push(msg);
Expand All @@ -79,7 +81,7 @@ function logErrorInstance(error, context) {
logger.error(message.join(' '));
} else {
// Unknown errors
logger.error(i18n(`${i18nKey}.unknownErrorOccured`));
logger.error(i18n(`${i18nKey}.unknownErrorOccurred`));
}
debugErrorAndContext(error, context);
}
Expand Down

0 comments on commit a19e657

Please sign in to comment.