Implement sending messages to server add-on
Reviewed By: mweststrate Differential Revision: D34073403 fbshipit-source-id: eacd73811b436f2b5c4255a83d8eb09367a96a67
This commit is contained in:
committed by
Facebook GitHub Bot
parent
12151e4a71
commit
842b2c810a
16
desktop/flipper-server-core/src/utils/safeJSONStringify.tsx
Normal file
16
desktop/flipper-server-core/src/utils/safeJSONStringify.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
export const safeJSONStringify = (data: unknown): string => {
|
||||
try {
|
||||
return JSON.stringify(data);
|
||||
} catch {
|
||||
return 'Unable to serialize';
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user