Skip to content

Commit

Permalink
fix: attribute, audience, event & experience fail cases
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed May 9, 2024
1 parent c933f81 commit c633199
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class ExportPersonalization {
}
} catch (error) {
this.exportConfig.personalizationEnabled = false;
log(this.exportConfig, `Failed to export Personalization project! ${error}`, 'error');
log(this.exportConfig, error, 'error');
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-import/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const config: DefaultConfig = {
// locales: ['fr-fr'],
host: 'https://api.contentstack.io/v3',
extensionHost: 'https://app.contentstack.com',
personalizationHost: 'https://personalization-api.contentstack.com',
personalizationHost: 'https://dev-personalization-api.csnonprod.com',
developerHubUrls: {
'https://api.contentstack.io': 'https://developerhub-api.contentstack.com',
'https://eu-api.contentstack.com': 'https://eu-developerhub-api.contentstack.com',
Expand Down
4 changes: 1 addition & 3 deletions packages/contentstack-variants/src/export/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ export default class ExportAttributes extends PersonalizationAdapter<ExportConfi

if (!this.attributes?.length) {
log(this.exportConfig, 'No Attributes found with the given project!', 'info');
return;
} else {
this.sanitizeAttribs();
fsUtil.writeFile(pResolve(this.attributesFolderPath, this.attributesConfig.fileName), this.attributes);
log(this.exportConfig, 'All the attributes have been exported successfully!', 'success');
return;
}
} catch (error) {
log(this.exportConfig, `Failed to export attributes!`, 'error');
throw error;
log(this.config, error, 'error');
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/export/audiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class ExportAudiences extends PersonalizationAdapter<ExportConfig
}
} catch (error) {
log(this.exportConfig, `Failed to export audiences!`, 'error');
throw error;
log(this.config, error, 'error');
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/export/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class ExportEvents extends PersonalizationAdapter<ExportConfig> {
}
} catch (error) {
log(this.exportConfig, `Failed to export events!`, 'error');
throw error;
log(this.config, error, 'error');
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/export/experiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class ExportExperiences extends PersonalizationAdapter<ExportConf
log(this.exportConfig, 'All the experiences have been exported successfully!', 'success');
} catch (error) {
log(this.exportConfig, `Failed to export experiences!`, 'error');
throw error;
log(this.config, error, 'error');
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/import/attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class Attribute extends PersonalizationAdapter<ImportConfig> {
this.log(this.config, this.$t(this.messages.CREATE_SUCCESS, { module: 'Attributes' }), 'info');
} catch (error) {
this.log(this.config, this.$t(this.messages.CREATE_FAILURE, { module: 'Attributes' }), 'error');
throw error;
this.log(this.config, error, 'error');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/import/audiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class Audiences extends PersonalizationAdapter<ImportConfig> {
this.log(this.config, this.$t(this.messages.CREATE_SUCCESS, { module: 'Audiences' }), 'info');
} catch (error) {
this.log(this.config, this.$t(this.messages.CREATE_FAILURE, { module: 'Audiences' }), 'error');
throw error;
this.log(this.config, error, 'error');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/import/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class Events extends PersonalizationAdapter<ImportConfig> {
this.log(this.config, this.$t(this.messages.CREATE_SUCCESS, { module: 'Events' }), 'info');
} catch (error) {
this.log(this.config, this.$t(this.messages.CREATE_FAILURE, { module: 'Events' }), 'error');
throw error;
this.log(this.config, error, 'error');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-variants/src/import/experiences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default class Experiences extends PersonalizationAdapter<ImportConfig> {
await this.createVariantIdMapper();
} catch (error) {
this.log(this.config, this.$t(this.messages.CREATE_FAILURE, { module: 'Experiences' }), 'error');
throw error;
this.log(this.config, error, 'error');
}
}
}
Expand Down

0 comments on commit c633199

Please sign in to comment.