diff --git a/server/cli.js b/server/cli.js index cf6a7fc..f8c6273 100644 --- a/server/cli.js +++ b/server/cli.js @@ -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}`); } } } diff --git a/server/services/main.js b/server/services/main.js index 0d2d0f4..0dba538 100644 --- a/server/services/main.js +++ b/server/services/main.js @@ -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}`); } },