Skip to content

Commit 5d6edcf

Browse files
authored
Merge pull request #336 from snehaljha-sf/only-labels
@W-19050490: Report labels and error handling
2 parents 767f0c2 + fc171ca commit 5d6edcf

27 files changed

+168
-151
lines changed

messages/assess.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
1414
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
1515
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
16-
"couldNotTruncate": "Could not truncate {0}",
16+
"couldNotTruncate": "Could not truncate %s",
1717
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
1818
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
1919
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
@@ -79,21 +79,21 @@
7979
"processingLwcsForAssessment": "Processing LWCs for assessment",
8080
"successfullyProcessedLwcsForAssessment": "Successfully processed %s LWCs for assessment",
8181
"lwcAssessmentResults": "LWC assessment results: %s",
82-
"errorReadingFiles": "Error in reading files: %s",
83-
"errorProcessingFiles": "Error in processing files: %s",
82+
"errorReadingFiles": "Error in reading files",
83+
"errorProcessingFiles": "Error in processing files",
8484
"startingProcessRelatedObjects": "Starting processRelatedObjects for %s in project path: %s",
8585
"errorProcessingApexFile": "Error processing Apex file: %s",
8686
"fileUpdatedToAllowRemoteCalls": "File will be updated to allow remote calls",
8787
"fileUpdatedToAllowCalls": "File will be updated to allow calls",
8888
"fileImplementsVlocityOpenInterface": "File %s implements VlocityOpenInterface no changes will be applied",
8989
"methodCallBundleNameUpdated": "Method call bundle name will be updated in %s for class %s method %s",
90-
"cardNameChangeMessage": "Card name will be changed from {0} to {1} to follow API naming standards",
91-
"authordNameChangeMessage": "Author name will be changed from {0} to {1} to follow API naming standards",
92-
"omniScriptNameChangeMessage": "OmniScript reference part {0} will be changed to {1} during migration.",
93-
"dataRaptorNameChangeMessage": "DataRaptor reference {0} will be changed to {1} during migration.",
94-
"integrationProcedureNameChangeMessage": "Integration Procedure reference {0} will be changed to {1} during migration.",
95-
"integrationProcedureManualUpdateMessage": "Integration Procedure reference {0} may need manual updates after migration.",
96-
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name {0} after name cleaning. This may cause conflicts during migration",
90+
"cardNameChangeMessage": "Card name will be changed from %s to %s to follow API naming standards",
91+
"authordNameChangeMessage": "Author name will be changed from %s to %s to follow API naming standards",
92+
"omniScriptNameChangeMessage": "OmniScript reference part %s will be changed to %s during migration.",
93+
"dataRaptorNameChangeMessage": "DataRaptor reference %s will be changed to %s during migration.",
94+
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
95+
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
96+
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
9797
"existingApexPrompt": "Do you have a sfdc project that already contains the APEX classes retrieved from your org? [y/n]",
9898
"enterExistingProjectPath": "Enter the path to the project folder that contains the retrieved APEX classes:",
9999
"invalidProjectFolderPath": "Provided project folder does not exist. Please provide a valid project folder path",
@@ -107,12 +107,12 @@
107107
"failedToGetValidProjectPath": "Failed to get valid project path",
108108
"errorRunningAssess": "Error running assess",
109109
"enableVerboseOutput": "Enable verbose output",
110-
"apexFileChangesIdentifiedNotApplied": "Changes identified for Apex class {0} but not applied (assessment mode)",
111-
"apexFileHasMultipleInterfaces": "File {0} has multiple interfaces including Callable, standardizing to System.Callable only",
112-
"apexFileImplementsVlocityOpenInterface2": "File {0} implements VlocityOpenInterface2, replacing with System.Callable",
110+
"apexFileChangesIdentifiedNotApplied": "Changes identified for Apex class %s but not applied (assessment mode)",
111+
"apexFileHasMultipleInterfaces": "File %s has multiple interfaces including Callable, standardizing to System.Callable only",
112+
"apexFileImplementsVlocityOpenInterface2": "File %s implements VlocityOpenInterface2, replacing with System.Callable",
113113
"errorParsingHtmlTemplate": "Error while parsing template",
114114
"errorParsingData": "Error while parsing data for template",
115-
"errorGeneratingHTML": "Error while generating HTML from template for {} with properties {}",
115+
"errorGeneratingHTML": "Error while generating HTML from template for %s with properties %s",
116116
"unexpectedError": "Unexpected Assessment error",
117-
"errorEvaluatingExpression": "Error evaluating expression: {0}, {1}"
117+
"errorEvaluatingExpression": "Error evaluating expression: %s, %s"
118118
}

messages/migrate.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
1717
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
1818
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
19-
"couldNotTruncate": "Could not truncate {0}",
19+
"couldNotTruncate": "Could not truncate %s",
2020
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
2121
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
2222
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
@@ -94,20 +94,23 @@
9494
"packageSelectionPrompt": "Enter the number of the package to use (1-%s):",
9595
"invalidPackageSelection": "Invalid selection. Please enter a number between 1 and %s.",
9696
"selectedPackage": "Selected package: %s (Version: %s)",
97-
"dataRaptorNameChangeMessage": "DataRaptor reference {0} will be changed to {1} during migration.",
98-
"integrationProcedureNameChangeMessage": "Integration Procedure reference {0} will be changed to {1} during migration.",
99-
"integrationProcedureManualUpdateMessage": "Integration Procedure reference {0} may need manual updates after migration.",
100-
"cardAuthorNameChangeMessage": "Card author name has been modified to fit naming rules: {0}",
101-
"cardNameChangeMessage": "Card name has been modified to fit naming rules: {0}",
102-
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name {0} after name cleaning. This may cause conflicts during migration",
97+
"dataRaptorNameChangeMessage": "DataRaptor reference %s will be changed to %s during migration.",
98+
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
99+
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
100+
"cardAuthorNameChangeMessage": "Card author name has been modified to fit naming rules: %s",
101+
"cardNameChangeMessage": "Card name has been modified to fit naming rules: %s",
102+
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
103103
"angularOmniscriptWarningMessage": " Angular OmniScript will not be migrated, please convert this to LWC based Omniscript",
104-
"apexFileChangesApplied": "Applied changes to Apex class {0}",
104+
"apexFileChangesApplied": "Applied changes to Apex class %s",
105105
"generatingComponentReports": "Generating report for components",
106106
"generatingRelatedObjectReports": "Generating report for related objects",
107107
"generatingMigrationReportDashboard": "Generating migration report dashboard",
108108
"errorParsingHtmlTemplate": "Error while parsing template",
109109
"errorParsingData": "Error while parsing data for template",
110-
"errorGeneratingHTML": "Error while generating HTML from template for {} with properties {}",
111-
"errorEvaluatingExpression": "Error evaluating expression: {0}, {1}",
112-
"manuallySwitchDesignerToStandardDataModel": "To complete the setup, please manually run the required Apex code to configure OmniStudio Designers to use the Standard Data Model <br> https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_change_the_sobject_data_model_after_migration.htm&type=5"
110+
"errorGeneratingHTML": "Error while generating HTML from template for %s with properties %s",
111+
"errorEvaluatingExpression": "Error evaluating expression: %s, %s",
112+
"manuallySwitchDesignerToStandardDataModel": "To complete the setup, please manually run the required Apex code to configure OmniStudio Designers to use the Standard Data Model <br> https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_change_the_sobject_data_model_after_migration.htm&type=5",
113+
"labelStatusSkipped": "Skipped",
114+
"labelStatusFailed": "Failed",
115+
"labelStatusComplete": "Complete"
113116
}

src/commands/omnistudio/migration/assess.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export default class Assess extends OmniStudioBaseCommand {
5656
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
5757
return await this.runAssess();
5858
} catch (error) {
59-
Logger.error(messages.getMessage('errorRunningAssess'));
60-
Logger.error(error);
59+
Logger.error(messages.getMessage('errorRunningAssess'), error);
6160
process.exit(1);
6261
}
6362
}

src/commands/omnistudio/migration/info.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export default class Org extends SfdxCommand {
5454
try {
5555
return await this.runInfo();
5656
} catch (error) {
57-
Logger.error('Error running info');
58-
Logger.error(error);
57+
Logger.error(messages.getMessage('errorRunningInfo'), error);
5958
process.exit(1);
6059
}
6160
}

src/commands/omnistudio/migration/migrate.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ export default class Migrate extends OmniStudioBaseCommand {
7373
return await this.runMigration();
7474
} catch (e) {
7575
const error = e as Error;
76-
Logger.error(`Error running migrate ${error.message}`);
77-
Logger.error(error);
76+
Logger.error(messages.getMessage('errorRunningMigrate'), error);
7877
process.exit(1);
7978
}
8079
}
@@ -252,8 +251,7 @@ export default class Migrate extends OmniStudioBaseCommand {
252251
})
253252
);
254253
} catch (ex: any) {
255-
Logger.error(JSON.stringify(ex));
256-
Logger.error(ex.stack);
254+
Logger.error('Error migrating object', ex);
257255
objectMigrationResults.push({
258256
name: cls.getName(),
259257
errors: [ex.message],
@@ -358,7 +356,7 @@ export default class Migrate extends OmniStudioBaseCommand {
358356
const obj = {
359357
id: record['Id'],
360358
name: migrationTool.getRecordName(record),
361-
status: 'Skipped',
359+
status: messages.getMessage('labelStatusSkipped'),
362360
errors: record['errors'],
363361
migratedId: undefined,
364362
warnings: [],
@@ -371,7 +369,10 @@ export default class Migrate extends OmniStudioBaseCommand {
371369
let errors: any[] = obj.errors || [];
372370
errors = errors.concat(recordResults.errors || []);
373371

374-
obj.status = !recordResults || recordResults.hasErrors ? 'Error' : 'Complete';
372+
obj.status =
373+
!recordResults || recordResults.hasErrors
374+
? messages.getMessage('labelStatusFailed')
375+
: messages.getMessage('labelStatusComplete');
375376
obj.errors = errors;
376377
obj.migratedId = recordResults.id;
377378
obj.warnings = recordResults.warnings;

src/javascripts/reportGeneratorUtility.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ function filterAndSearchTable(tableId) {
5555
const visibleRows = Array.from(table.rows).filter(
5656
(row) => row.style.display !== 'none' && row.id !== 'no-rows-message'
5757
);
58-
reportTable.querySelector('#row-count').textContent = `Showing ${visibleRows.length} record${
59-
visibleRows.length !== 1 ? 's' : ''
60-
}`;
58+
reportTable.querySelector('#row-count').textContent = `Total Records: ${visibleRows.length}`;
6159
return;
6260
}
6361

src/migration/dataraptor.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
8181
);
8282
drItem[this.namespacePrefix + 'Formula__c'] = originalString;
8383
} catch (ex) {
84-
Logger.error(JSON.stringify(ex));
85-
Logger.error(ex.stack);
84+
Logger.error('Error updating formula for data mapper', ex);
8685
Logger.logVerbose(
8786
this.messages.getMessage('formulaSyntaxError', [drItem[this.namespacePrefix + 'Formula__c']])
8887
);
@@ -216,8 +215,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
216215
const dataRaptorAssessmentInfos = this.processDRComponents(dataRaptors);
217216
return dataRaptorAssessmentInfos;
218217
} catch (err) {
219-
Logger.error(JSON.stringify(err));
220-
Logger.error(err.stack);
218+
Logger.error('Error assessing data mapper', err);
221219
}
222220
}
223221

@@ -259,8 +257,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
259257
apexDependencies: [],
260258
});
261259
const error = e as Error;
262-
Logger.error(JSON.stringify(error));
263-
Logger.error(error.stack);
260+
Logger.error('Error processing data mapper', error);
264261
}
265262
progressBar.update(++progressCounter);
266263
}
@@ -318,8 +315,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
318315
});
319316
}
320317
} catch (ex) {
321-
Logger.error(JSON.stringify(ex));
322-
Logger.error(ex.stack);
318+
Logger.error('Error processing formula for data mapper', ex);
323319
Logger.logVerbose(this.messages.getMessage('formulaSyntaxError', [formula]));
324320
}
325321
}

src/migration/flexcard.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
104104
const flexCardsAssessmentInfos = this.processCardComponents(flexCards);
105105
return flexCardsAssessmentInfos;
106106
} catch (err) {
107-
Logger.error(this.messages.getMessage('errorDuringFlexCardAssessment'));
108-
Logger.error(JSON.stringify(err));
109-
Logger.error(err.stack);
107+
Logger.error(this.messages.getMessage('errorDuringFlexCardAssessment'), err);
110108
}
111109
}
112110

@@ -136,8 +134,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
136134
warnings: [this.messages.getMessage('unexpectedError')],
137135
});
138136
const error = e as Error;
139-
Logger.error(JSON.stringify(error));
140-
Logger.error(error.stack);
137+
Logger.error('Error processing flex card', error);
141138
}
142139
progressBar.update(++progressCounter);
143140
}

src/migration/omniscript.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
194194
);
195195
return omniAssessmentInfos;
196196
} catch (err) {
197-
Logger.error(this.messages.getMessage('errorDuringOmniScriptAssessment'));
198-
Logger.error(JSON.stringify(err));
199-
Logger.error(err.stack);
197+
Logger.error(this.messages.getMessage('errorDuringOmniScriptAssessment'), err);
200198
}
201199
}
202200

@@ -267,8 +265,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
267265
});
268266
}
269267
const error = e as Error;
270-
Logger.error(JSON.stringify(error));
271-
Logger.error(error.stack);
268+
Logger.error('Error processing omniscripts', error);
272269
continue;
273270
}
274271
if (omniAssessmentInfo.type === 'OmniScript') {
@@ -557,8 +554,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
557554
);
558555
ipElement[`${this.namespacePrefix}PropertySet__c`] = originalString;
559556
} catch (ex) {
560-
Logger.error(JSON.stringify(ex));
561-
Logger.error(ex.stack);
557+
Logger.error('Error processing formula for integration procedure', ex);
562558
Logger.logVerbose(
563559
this.messages.getMessage('formulaSyntaxError', [ipElement[`${this.namespacePrefix}PropertySet__c`]])
564560
);

src/migration/related/ApexMigration.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,7 @@ export class ApexMigration extends BaseRelatedObjectMigration {
105105
fileAssessmentInfo.push(apexAssementInfo);
106106
Logger.logVerbose(assessMessages.getMessage('successfullyProcessedApexFile', [file.name]));
107107
} catch (err) {
108-
Logger.error(assessMessages.getMessage('errorProcessingApexFile', [file.name]));
109-
Logger.error(JSON.stringify(err));
110-
if (err instanceof Error) {
111-
Logger.error(err.stack);
112-
}
108+
Logger.error(assessMessages.getMessage('errorProcessingApexFile', [file.name]), err);
113109
}
114110
Logger.logVerbose(assessMessages.getMessage('successfullyProcessedApexFile', [file.name]));
115111
}

0 commit comments

Comments
 (0)