Fixed an exception when logging unserializable errors

Reviewed By: nikoant

Differential Revision: D33276412

fbshipit-source-id: 615b2cc523a3ab4445a1208f460753b8634f6812
This commit is contained in:
Michel Weststrate
2021-12-22 03:17:46 -08:00
committed by Facebook GitHub Bot
parent 74fa34fe98
commit 87833c759e
3 changed files with 8 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ test('Correct top level API exposed', () => {
"path", "path",
"produce", "produce",
"renderReactRoot", "renderReactRoot",
"safeStringify",
"sleep", "sleep",
"styled", "styled",
"textContent", "textContent",

View File

@@ -134,6 +134,7 @@ export {textContent} from './utils/textContent';
import * as path from './utils/path'; import * as path from './utils/path';
export {path}; export {path};
export * from './utils/uuid'; export * from './utils/uuid';
export {safeStringify} from './utils/safeStringify';
// It's not ideal that this exists in flipper-plugin sources directly, // It's not ideal that this exists in flipper-plugin sources directly,
// but is the least pain for plugin authors. // but is the least pain for plugin authors.

View File

@@ -1166,6 +1166,12 @@ Usage: `uuid()`
Returns UUID V4. Returns UUID V4.
### safeStringify
Usage: `safeStringify(dataStructure)`
Serialises the given data structure using `JSON.stringify`, but doesn't throw if the processes failed, but rather returns a `<unserializable ...>` string.
## TestUtils ## TestUtils
The object `TestUtils` as exposed from `flipper-plugin` exposes utilities to write unit tests for Sandy plugins. The object `TestUtils` as exposed from `flipper-plugin` exposes utilities to write unit tests for Sandy plugins.