Implement sending messages from desktop to add-on
Reviewed By: antonk52 Differential Revision: D34239803 fbshipit-source-id: 1a18d522ba877ade3d0703fbb374c15b596241d7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2ce037d96b
commit
4067f5bd88
@@ -16,6 +16,11 @@ import {
|
||||
export interface ServerAddOnControls {
|
||||
start: FlipperServerCommands['plugins-server-add-on-start'];
|
||||
stop: FlipperServerCommands['plugins-server-add-on-stop'];
|
||||
sendMessage: (
|
||||
pluginName: string,
|
||||
method: string,
|
||||
params?: unknown,
|
||||
) => Promise<object | string | number | boolean | null>;
|
||||
}
|
||||
|
||||
// TODO: Share with js-flipper? Is it worth it?
|
||||
|
||||
@@ -45,6 +45,7 @@ export {
|
||||
isAuthError,
|
||||
getStringFromErrorLike,
|
||||
getErrorFromErrorLike,
|
||||
deserializeRemoteError,
|
||||
} from './utils/errors';
|
||||
export * from './GK';
|
||||
export * from './clientUtils';
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {ClientErrorType} from '../server-types';
|
||||
|
||||
export function isAuthError(
|
||||
err: any,
|
||||
): err is UserNotSignedInError | UserUnauthorizedError {
|
||||
@@ -114,3 +116,10 @@ export function getStringFromErrorLike(e: any): string {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const deserializeRemoteError = (serializedError: ClientErrorType) => {
|
||||
const err = new Error(serializedError.message);
|
||||
err.name = serializedError.name;
|
||||
err.stack += `. Caused by: ${serializedError.stacktrace}`;
|
||||
return err;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user