Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public createExtensionsDataForCreation(content: any): any {
if (DataFormat.isKnownFormat(content)) {
const { valid, errors } = DataFormat.validate(content);
if (!valid) {
const errorsToShow = errors.map((e: any) => JSON.stringify(e)).join('\n');
throw new Error(
`The content data seem to follow a request format but contains errors: ${errorsToShow}`,
);
}
}
return this.extension.createCreationAction({ content });
}