Skip to content

Commit ede74e5

Browse files
yungstersfacebook-github-bot
authored andcommitted
RN: Cleanup ExtendedError Type
Summary: Cleans up the `ExtendedError` internal type and moves it into a separate module instead of burying it in `parseErrorStack.js`. Also, this resolves some unnecessary Flow type suppressions. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D28470299 fbshipit-source-id: 04093243f06f67f41567270ef9778f01c7549b05
1 parent 0dba0af commit ede74e5

File tree

8 files changed

+24
-16
lines changed

8 files changed

+24
-16
lines changed

IntegrationTests/GlobalEvalWithSourceUrlTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
'use strict';
1212

13-
import type {ExtendedError} from 'react-native/Libraries/Core/Devtools/parseErrorStack';
13+
import type {ExtendedError} from 'react-native/Libraries/Core/ExtendedError';
1414

1515
const React = require('react');
1616
const ReactNative = require('react-native');

Libraries/BatchedBridge/NativeModules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const BatchedBridge = require('./BatchedBridge');
1414

1515
const invariant = require('invariant');
1616

17-
import type {ExtendedError} from '../Core/Devtools/parseErrorStack';
17+
import type {ExtendedError} from '../Core/ExtendedError';
1818

1919
export type ModuleConfig = [
2020
string /* name */,

Libraries/Core/Devtools/parseErrorStack.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ import type {HermesParsedStack} from './parseHermesStack';
1515

1616
const parseHermesStack = require('./parseHermesStack');
1717

18-
// $FlowFixMe[incompatible-exact]
19-
export type ExtendedError = Error &
20-
interface {
21-
jsEngine?: string,
22-
preventSymbolication?: boolean,
23-
componentStack?: string,
24-
forceRedbox?: boolean,
25-
isComponentError?: boolean,
26-
};
27-
2818
function convertHermesStack(stack: HermesParsedStack): Array<StackFrame> {
2919
const frames = [];
3020
for (const entry of stack.entries) {

Libraries/Core/ExceptionsManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
'use strict';
1212

13-
import type {ExtendedError} from './Devtools/parseErrorStack';
13+
import type {ExtendedError} from './ExtendedError';
1414
import type {ExceptionData} from './NativeExceptionsManager';
1515

1616
class SyntheticError extends Error {

Libraries/Core/ExtendedError.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict
8+
* @format
9+
*/
10+
11+
export type ExtendedError = Error & {
12+
jsEngine?: string,
13+
preventSymbolication?: boolean,
14+
componentStack?: string,
15+
forceRedbox?: boolean,
16+
isComponentError?: boolean,
17+
...
18+
};

Libraries/Core/ReactFiberErrorDialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import {handleException, SyntheticError} from './ExceptionsManager';
1212

13-
import type {ExtendedError} from './Devtools/parseErrorStack';
13+
import type {ExtendedError} from './ExtendedError';
1414

1515
export type CapturedError = {
1616
+componentStack: string,

Libraries/LogBox/Data/LogBoxData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type {
2121
ExtendedExceptionData,
2222
} from './parseLogBoxLog';
2323
import parseErrorStack from '../../Core/Devtools/parseErrorStack';
24-
import type {ExtendedError} from '../../Core/Devtools/parseErrorStack';
24+
import type {ExtendedError} from '../../Core/ExtendedError';
2525
import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
2626
export type LogBoxLogs = Set<LogBoxLog>;
2727
export type LogData = $ReadOnly<{|

Libraries/Utilities/HMRClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const prettyFormat = require('pretty-format');
1717
import getDevServer from '../Core/Devtools/getDevServer';
1818
import NativeRedBox from '../NativeModules/specs/NativeRedBox';
1919
import LogBox from '../LogBox/LogBox';
20-
import type {ExtendedError} from '../Core/Devtools/parseErrorStack';
20+
import type {ExtendedError} from '../Core/ExtendedError';
2121

2222
const pendingEntryPoints = [];
2323
let hmrClient = null;

0 commit comments

Comments
 (0)