diff --git a/lib/repo.js b/lib/repo.js index b6a8cc3..2c61c7a 100644 --- a/lib/repo.js +++ b/lib/repo.js @@ -29,9 +29,17 @@ export default class WikibaseRepository { if (!this.edit) { return Promise.reject(new Error('Cannot edit a read only instance.')) } - return Promise.all(entities.map(async entity => { + return Promise.allSettled(entities.map(async entity => { return this.edit.entity.create(entity) })) + .then((results) => { + for (const result of results) { + if (result.status === 'rejected') { + throw new Error(result.reason) + } + } + return results.map(v => v.value) + }) } getEntities (...identifiers) {