Skip to content

Commit

Permalink
small format tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlmacdonald authored and erquhart committed May 14, 2018
1 parent 9d2acc6 commit d2c8074
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/backends/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,17 @@ class Backend {
(error instanceof EditorialWorkflowError && error.notUnderEditorialWorkflow) ?
Promise.resolve(false) :
Promise.reject(error)));

if (existingEntry) throw (new Error(errorMessage));
return await this.implentation.getEntry(collection, slug, path)

const publishedEntry = await this.implementation.getEntry(collection, slug, path)
.then(result => {
if (result.data !== undefined) throw (new Error(errorMessage));
else return {path, slug, raw: this.entryToRaw(collection, entryDraft.get("entry"))};
return result.data;
});

if (publishedEntry) throw (new Error(errorMessage));

return {path, slug, raw: this.entryToRaw(collection, entryDraft.get("entry"))};
}

async persistEntry(config, collection, entryDraft, MediaFiles, integrations, options = {}) {
Expand Down

0 comments on commit d2c8074

Please sign in to comment.