mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0dba0aff18
commit
ede74e5936
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ExtendedError} from 'react-native/Libraries/Core/Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from 'react-native/Libraries/Core/ExtendedError';
|
||||
|
||||
const React = require('react');
|
||||
const ReactNative = require('react-native');
|
||||
|
||||
@@ -14,7 +14,7 @@ const BatchedBridge = require('./BatchedBridge');
|
||||
|
||||
const invariant = require('invariant');
|
||||
|
||||
import type {ExtendedError} from '../Core/Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from '../Core/ExtendedError';
|
||||
|
||||
export type ModuleConfig = [
|
||||
string /* name */,
|
||||
|
||||
@@ -15,16 +15,6 @@ import type {HermesParsedStack} from './parseHermesStack';
|
||||
|
||||
const parseHermesStack = require('./parseHermesStack');
|
||||
|
||||
// $FlowFixMe[incompatible-exact]
|
||||
export type ExtendedError = Error &
|
||||
interface {
|
||||
jsEngine?: string,
|
||||
preventSymbolication?: boolean,
|
||||
componentStack?: string,
|
||||
forceRedbox?: boolean,
|
||||
isComponentError?: boolean,
|
||||
};
|
||||
|
||||
function convertHermesStack(stack: HermesParsedStack): Array<StackFrame> {
|
||||
const frames = [];
|
||||
for (const entry of stack.entries) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ExtendedError} from './Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from './ExtendedError';
|
||||
import type {ExceptionData} from './NativeExceptionsManager';
|
||||
|
||||
class SyntheticError extends Error {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type ExtendedError = Error & {
|
||||
jsEngine?: string,
|
||||
preventSymbolication?: boolean,
|
||||
componentStack?: string,
|
||||
forceRedbox?: boolean,
|
||||
isComponentError?: boolean,
|
||||
...
|
||||
};
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import {handleException, SyntheticError} from './ExceptionsManager';
|
||||
|
||||
import type {ExtendedError} from './Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from './ExtendedError';
|
||||
|
||||
export type CapturedError = {
|
||||
+componentStack: string,
|
||||
|
||||
@@ -21,7 +21,7 @@ import type {
|
||||
ExtendedExceptionData,
|
||||
} from './parseLogBoxLog';
|
||||
import parseErrorStack from '../../Core/Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from '../../Core/Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from '../../Core/ExtendedError';
|
||||
import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
|
||||
export type LogBoxLogs = Set<LogBoxLog>;
|
||||
export type LogData = $ReadOnly<{|
|
||||
|
||||
@@ -17,7 +17,7 @@ const prettyFormat = require('pretty-format');
|
||||
import getDevServer from '../Core/Devtools/getDevServer';
|
||||
import NativeRedBox from '../NativeModules/specs/NativeRedBox';
|
||||
import LogBox from '../LogBox/LogBox';
|
||||
import type {ExtendedError} from '../Core/Devtools/parseErrorStack';
|
||||
import type {ExtendedError} from '../Core/ExtendedError';
|
||||
|
||||
const pendingEntryPoints = [];
|
||||
let hmrClient = null;
|
||||
|
||||
Reference in New Issue
Block a user