Don't leave rejection unhandled if node fetching fails
Summary: Fix potentially unhandled promise rejection in Layout inspector. Not really reproducible, and probably originating from old Flipper versions (no trace is available either), since we have a lot of connection check in place. Just in case still handled the exception, for example if something goes wrong on client side Reviewed By: passy Differential Revision: D31267465 fbshipit-source-id: d1b384db7bb010af8d2aa12ae29110f343fb14af
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8fd012a8a3
commit
b8236f1b3a
@@ -312,11 +312,15 @@ export default class Inspector extends Component<Props, State> {
|
|||||||
): Promise<Array<Element>> {
|
): Promise<Array<Element>> {
|
||||||
if (ids.length > 0 && this.props.client.isConnected) {
|
if (ids.length > 0 && this.props.client.isConnected) {
|
||||||
const {forAccessibilityEvent} = options;
|
const {forAccessibilityEvent} = options;
|
||||||
const {elements}: {elements: Array<Element>} =
|
const {elements}: {elements: Array<Element>} = await this.props.client
|
||||||
await this.props.client.call(this.call().GET_NODES, {
|
.call(this.call().GET_NODES, {
|
||||||
ids,
|
ids,
|
||||||
forAccessibilityEvent,
|
forAccessibilityEvent,
|
||||||
selected: false,
|
selected: false,
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error(`[Layout] Failed to fetch nodes from app:`, e);
|
||||||
|
return {elements: []};
|
||||||
});
|
});
|
||||||
if (!elements) {
|
if (!elements) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -110,7 +110,12 @@ export default class LayoutPlugin extends FlipperPlugin<
|
|||||||
callClient,
|
callClient,
|
||||||
'getNodes',
|
'getNodes',
|
||||||
supportsMethod,
|
supportsMethod,
|
||||||
);
|
).catch((e) => {
|
||||||
|
console.error(
|
||||||
|
`[Layout] Failed to fetch Nodes from app while creating export`,
|
||||||
|
e,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const AXelements: ElementMap = {};
|
const AXelements: ElementMap = {};
|
||||||
if (rootAXElement) {
|
if (rootAXElement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user