chore: Add more declarative CLI error logging
parent
1dfc90a9c0
commit
dc2ea316c5
|
@ -178,7 +178,7 @@ const handleAction = async (syncType, skipConfirm, configType, partials) => {
|
|||
}));
|
||||
console.log(`${chalk.green.bold('[success]')} Finished import`);
|
||||
} catch (e) {
|
||||
console.log(`${chalk.red.bold('[error]')} Something went wrong during the import. ${e}`);
|
||||
console.log(`${chalk.red.bold('[error]')} ${e}`);
|
||||
}
|
||||
}
|
||||
if (syncType === 'export') {
|
||||
|
@ -190,7 +190,7 @@ const handleAction = async (syncType, skipConfirm, configType, partials) => {
|
|||
}));
|
||||
console.log(`${chalk.green.bold('[success]')} Finished export`);
|
||||
} catch (e) {
|
||||
console.log(`${chalk.red.bold('[error]')} Something went wrong during the export. ${e}`);
|
||||
console.log(`${chalk.red.bold('[error]')} ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,11 +227,9 @@ module.exports = () => ({
|
|||
|
||||
try {
|
||||
await strapi.plugin('config-sync').types[type].importSingle(name, fileContents);
|
||||
if (onSuccess) {
|
||||
onSuccess(`${type}.${name}`);
|
||||
}
|
||||
if (onSuccess) onSuccess(`${type}.${name}`);
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
throw new Error(`Error when trying to import ${type}.${name}. ${e}`);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -240,6 +238,7 @@ module.exports = () => ({
|
|||
*
|
||||
* @param {string} configName - The name of the config file.
|
||||
* @param {object} onSuccess - Success callback to run on each single successfull import.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
exportSingleConfig: async (configName, onSuccess) => {
|
||||
|
@ -252,11 +251,9 @@ module.exports = () => ({
|
|||
|
||||
try {
|
||||
await strapi.plugin('config-sync').types[type].exportSingle(configName);
|
||||
if (onSuccess) {
|
||||
onSuccess(`${type}.${name}`);
|
||||
}
|
||||
if (onSuccess) onSuccess(`${type}.${name}`);
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
throw new Error(`Error when trying to export ${type}.${name}. ${e}`);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue