Add catch handlers to client calls
Summary: Client calls return a promise. Not dealing with the error causes promise unhandled rejection errors. This change adds a catch block and logs the error instead. Reviewed By: antonk52 Differential Revision: D37955029 fbshipit-source-id: 50cac5a5339961d16868ab2102d3c77790e6943c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2bb3f407b5
commit
c871b221fd
@@ -287,10 +287,14 @@ export default class LayoutPlugin extends FlipperPlugin<
|
|||||||
);
|
);
|
||||||
const resolvedPath = IDEFileResolver.getBestPath(paths, params.className);
|
const resolvedPath = IDEFileResolver.getBestPath(paths, params.className);
|
||||||
if (this.client.isConnected) {
|
if (this.client.isConnected) {
|
||||||
this.client.send('setResolvedPath', {
|
this.client
|
||||||
className: params.className,
|
.call('setResolvedPath', {
|
||||||
resolvedPath: resolvedPath,
|
className: params.className,
|
||||||
});
|
resolvedPath: resolvedPath,
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.warn('[Layout] setResolvePath failed with error', e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -315,7 +319,9 @@ export default class LayoutPlugin extends FlipperPlugin<
|
|||||||
if (this.client.isConnected) {
|
if (this.client.isConnected) {
|
||||||
const inTargetMode = !this.state.inTargetMode;
|
const inTargetMode = !this.state.inTargetMode;
|
||||||
this.setState({inTargetMode});
|
this.setState({inTargetMode});
|
||||||
this.client.send('setSearchActive', {active: inTargetMode});
|
this.client.call('setSearchActive', {active: inTargetMode}).catch((e) => {
|
||||||
|
console.warn('[Layout] setSearchActive failed with error', e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -388,12 +394,16 @@ export default class LayoutPlugin extends FlipperPlugin<
|
|||||||
path: Array.from(path).splice(1).join(),
|
path: Array.from(path).splice(1).join(),
|
||||||
...this.realClient.query,
|
...this.realClient.query,
|
||||||
});
|
});
|
||||||
this.client.call('setData', {
|
this.client
|
||||||
id,
|
.call('setData', {
|
||||||
path,
|
id,
|
||||||
value,
|
path,
|
||||||
ax: this.state.inAXMode,
|
value,
|
||||||
});
|
ax: this.state.inAXMode,
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.warn('[Layout] setData failed with error', e);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
loadScreenDimensions(): {width: number; height: number} | null {
|
loadScreenDimensions(): {width: number; height: number} | null {
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ export default class LeakCanary<PersistedState> extends FlipperPlugin<
|
|||||||
selectedIdx: null,
|
selectedIdx: null,
|
||||||
selectedEid: null,
|
selectedEid: null,
|
||||||
});
|
});
|
||||||
this.client.call('clear');
|
this.client.call('clear').catch((e) => {
|
||||||
|
console.warn('[LeakCanary] clear failed with error', e);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_selectElement = (leakIdx: number, eid: string) => {
|
_selectElement = (leakIdx: number, eid: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user