diff --git a/src/export.js b/src/export.js index 1933bbc..e0bd548 100644 --- a/src/export.js +++ b/src/export.js @@ -51,16 +51,29 @@ exports.handler = async function (options) { const client = await getClient(options) const console = new Console(process.stderr) + if (options.entities.length === 0 && options.index.length === 0) { + process.stderr.write('Error: No entities specified. Use --entities to specify what to export.\n') + process.exit(1) + } + console.time('Export') return client .export(options.format, [...options.entities, ...options.index], options.outputFile) .then(entities => { console.timeEnd('Export') - for (const { status, reason } of entities) { - if (status === 'rejected') { - console.error(reason) - } + const rejected = entities.filter(e => e.status === 'rejected') + const fulfilled = entities.filter(e => e.status === 'fulfilled') + + for (const { reason } of rejected) { + process.stderr.write(`Error: ${reason.message}\n`) + } + + if (rejected.length > 0 && fulfilled.length === 0) { + process.stderr.write(`\nAll exports failed. Please check your format and entity options.\n`) + process.stderr.write(`Note: Some formats like 'atf' may not be available for direct export.\n`) + process.stderr.write(`Try using a different format such as 'ndjson', 'csv', or 'ntriples'.\n`) + process.exit(1) } }) }