When using the WordPress Data module (@wordpress/data
, part of the Gutenberg project), it's easy to fetch posts or other entities using select('core').getEntityRecords
method. Here's an example of Gutenberg using it internally.
However I can't find a way to handle errors in this scenario (e.g. a network error). Just as there is a method for checking if the request is in progress (isResolving
), I'd expect one for error handling.
Some context:
getEntityRecords
methodapiFetch
handler, used bygetEntityRecords
internally