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`);
|
console.log(`${chalk.green.bold('[success]')} Finished import`);
|
||||||
} catch (e) {
|
} 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') {
|
if (syncType === 'export') {
|
||||||
|
@ -190,7 +190,7 @@ const handleAction = async (syncType, skipConfirm, configType, partials) => {
|
||||||
}));
|
}));
|
||||||
console.log(`${chalk.green.bold('[success]')} Finished export`);
|
console.log(`${chalk.green.bold('[success]')} Finished export`);
|
||||||
} catch (e) {
|
} 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 {
|
try {
|
||||||
await strapi.plugin('config-sync').types[type].importSingle(name, fileContents);
|
await strapi.plugin('config-sync').types[type].importSingle(name, fileContents);
|
||||||
if (onSuccess) {
|
if (onSuccess) onSuccess(`${type}.${name}`);
|
||||||
onSuccess(`${type}.${name}`);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} 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 {string} configName - The name of the config file.
|
||||||
* @param {object} onSuccess - Success callback to run on each single successfull import.
|
* @param {object} onSuccess - Success callback to run on each single successfull import.
|
||||||
|
*
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
exportSingleConfig: async (configName, onSuccess) => {
|
exportSingleConfig: async (configName, onSuccess) => {
|
||||||
|
@ -252,11 +251,9 @@ module.exports = () => ({
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await strapi.plugin('config-sync').types[type].exportSingle(configName);
|
await strapi.plugin('config-sync').types[type].exportSingle(configName);
|
||||||
if (onSuccess) {
|
if (onSuccess) onSuccess(`${type}.${name}`);
|
||||||
onSuccess(`${type}.${name}`);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(`Error when trying to export ${type}.${name}. ${e}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue