supportsMethod should return false if not connected
Summary: https://www.internalfb.com/logview/details/flipper_javascript/7e72d9f75d047791d9de43b72915cbd4/?selected-logview-tab=latest shows an exception for just checking whether a feature is supported, while the client is not connected. there is no point in checking if a feature is supported if not connected, so just returning false instead of throwing Reviewed By: timur-valiev Differential Revision: D36371047 fbshipit-source-id: 6e83bed6fc53cc41ddef30eeeb41d030b2c4c175
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ee89b5a37f
commit
e51e95af2e
@@ -503,6 +503,9 @@ export default abstract class AbstractClient extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async supportsMethod(api: string, method: string): Promise<boolean> {
|
async supportsMethod(api: string, method: string): Promise<boolean> {
|
||||||
|
if (!this.connected.get()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const response = await this.rawCall<{
|
const response = await this.rawCall<{
|
||||||
isSupported: boolean;
|
isSupported: boolean;
|
||||||
}>('isMethodSupported', true, {
|
}>('isMethodSupported', true, {
|
||||||
|
|||||||
@@ -207,7 +207,6 @@ export class SandyPluginInstance extends BasePluginInstance {
|
|||||||
this.events.on('unhandled-event', batched(cb));
|
this.events.on('unhandled-event', batched(cb));
|
||||||
},
|
},
|
||||||
supportsMethod: async (method) => {
|
supportsMethod: async (method) => {
|
||||||
this.assertConnected();
|
|
||||||
return await realClient.supportsMethod(
|
return await realClient.supportsMethod(
|
||||||
this.definition.id,
|
this.definition.id,
|
||||||
method as any,
|
method as any,
|
||||||
|
|||||||
Reference in New Issue
Block a user