Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const message = [
chalk.red.bold(`${e.message}\n`),
chalk.red.bold('🚨 Migration unsuccessful')
].join('\n')
console.log(message)
process.exit(1)
}
console.log(e)
process.exit(1)
}
if (parseResult.hasStepsValidationErrors()) {
stepsError.default(parseResult.stepsValidationErrors)
process.exit(1)
}
if (parseResult.hasPayloadValidationErrors()) {
stepsError.default(parseResult.payloadValidationErrors)
process.exit(1)
}
// const migrationName = path.basename(argv.filePath, '.js');
// const errorsFile = path.join(process.cwd(), `errors-${migrationName}-${Date.now()}.log`);
const errorsFile = path.join(process.cwd(), `errors-${Date.now()}.log`)
const { batches } = parseResult
if (parseResult.hasValidationErrors()) {
renderMigration.renderValidationErrors(batches)
process.exit(1)
}
if (parseResult.hasRuntimeErrors()) {
renderMigration.renderRuntimeErrors(batches, errorsFile)
await writeErrorsToLog.default(parseResult.getRuntimeErrors(), errorsFile)
process.exit(1)
}
await renderMigration.renderPlan(batches)
try {
parseResult = await migrationParser(migrationFunction)
} catch (e) {
if (e instanceof SpaceAccessError) {
const message = [
chalk.red.bold(`${e.message}\n`),
chalk.red.bold('🚨 Migration unsuccessful')
].join('\n')
console.log(message)
process.exit(1)
}
console.log(e)
process.exit(1)
}
if (parseResult.hasStepsValidationErrors()) {
stepsError.default(parseResult.stepsValidationErrors)
process.exit(1)
}
if (parseResult.hasPayloadValidationErrors()) {
stepsError.default(parseResult.payloadValidationErrors)
process.exit(1)
}
// const migrationName = path.basename(argv.filePath, '.js');
// const errorsFile = path.join(process.cwd(), `errors-${migrationName}-${Date.now()}.log`);
const errorsFile = path.join(process.cwd(), `errors-${Date.now()}.log`)
const { batches } = parseResult
if (parseResult.hasValidationErrors()) {
renderMigration.renderValidationErrors(batches)
process.exit(1)
}
if (parseResult.hasRuntimeErrors()) {
renderMigration.renderRuntimeErrors(batches, errorsFile)