diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index c46b4b4314827e..fda58b2fe9ea87 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -107,10 +107,6 @@ export const getEntityRecord = ( kind, name, key = '', query ) => async ( { const record = await apiFetch( { path } ); dispatch.receiveEntityRecords( kind, name, record, query ); - } catch ( error ) { - // We need a way to handle and access REST API errors in state - // Until then, catching the error ensures the resolver is marked as resolved. - // See similar implementation in `getEntityRecords()`. } finally { dispatch.__unstableReleaseStoreLock( lock ); } @@ -205,10 +201,6 @@ export const getEntityRecords = ( kind, name, query = {} ) => async ( { args: resolutionsArgs, } ); } - } catch ( error ) { - // We need a way to handle and access REST API errors in state - // Until then, catching the error ensures the resolver is marked as resolved. - // See similar implementation in `getEntityRecord()`. } finally { dispatch.__unstableReleaseStoreLock( lock ); } diff --git a/packages/editor/src/store/test/actions.js b/packages/editor/src/store/test/actions.js index 1b4454010ceaf0..6931f1cbbfde95 100644 --- a/packages/editor/src/store/test/actions.js +++ b/packages/editor/src/store/test/actions.js @@ -83,6 +83,13 @@ describe( 'Post actions', () => { path.startsWith( `/wp/v2/posts/${ postId }` ) ) { return { ...post, ...data }; + } else if ( + // This URL is requested by the actions dispatched in this test. + // They are safe to ignore and are only listed here to avoid triggeringan error. + method === 'GET' && + path.startsWith( '/wp/v2/types/post' ) + ) { + return {}; } throw { @@ -163,6 +170,15 @@ describe( 'Post actions', () => { } else if ( method === 'GET' ) { return []; } + } else if ( method === 'GET' ) { + // These URLs are requested by the actions dispatched in this test. + // They are safe to ignore and are only listed here to avoid triggeringan error. + if ( + path.startsWith( '/wp/v2/types/post' ) || + path.startsWith( `/wp/v2/posts/${ postId }` ) + ) { + return {}; + } } throw { @@ -239,6 +255,13 @@ describe( 'Post actions', () => { ...data, }; } + // This URL is requested by the actions dispatched in this test. + // They are safe to ignore and are only listed here to avoid triggeringan error. + } else if ( + method === 'GET' && + path.startsWith( '/wp/v2/types/post' ) + ) { + return {}; } throw {