fix: replace instanceof check (#6284)

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>
This commit is contained in:
Ryan Ahearn 2022-03-14 08:34:44 -04:00 committed by GitHub
parent 964d6975df
commit a0d3917249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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';
@ -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);