Skip to content

Commit

Permalink
fix: replace instanceof check (#6284)
Browse files Browse the repository at this point in the history
error instanceof EditorialWorkflowError was returning false
for a custom backend that inherited from GitGatewayBackend

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
rahearn and kodiakhq[bot] authored Mar 14, 2022
1 parent 964d697 commit a0d3917
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/netlify-cms-core/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
localForage,
Cursor,
CURSOR_COMPATIBILITY_SYMBOL,
EditorialWorkflowError,
getPathDepth,
blobToFileObj,
asyncLock,
EDITORIAL_WORKFLOW_ERROR,
} from 'netlify-cms-lib-util';
import { basename, join, extname, dirname } from 'path';
import { stringTemplate } from 'netlify-cms-lib-widgets';
Expand Down Expand Up @@ -417,7 +417,7 @@ export class Backend {
(await this.implementation
.unpublishedEntry({ collection: collection.get('name'), slug })
.catch(error => {
if (error instanceof EditorialWorkflowError && error.notUnderEditorialWorkflow) {
if (error.name === EDITORIAL_WORKFLOW_ERROR && error.notUnderEditorialWorkflow) {
return Promise.resolve(false);
}
return Promise.reject(error);
Expand Down

0 comments on commit a0d3917

Please sign in to comment.