Log all errors to console.error by default (#21130)
This commit is contained in:
parent
d1294c9d40
commit
0853aab74d
|
@ -156,10 +156,15 @@ describe('ReactFlight', () => {
|
|||
return <div ref={ref} />;
|
||||
}
|
||||
|
||||
const event = ReactNoopFlightServer.render(<EventHandlerProp />);
|
||||
const fn = ReactNoopFlightServer.render(<FunctionProp />);
|
||||
const symbol = ReactNoopFlightServer.render(<SymbolProp />);
|
||||
const refs = ReactNoopFlightServer.render(<RefProp />);
|
||||
const options = {
|
||||
onError() {
|
||||
// ignore
|
||||
},
|
||||
};
|
||||
const event = ReactNoopFlightServer.render(<EventHandlerProp />, options);
|
||||
const fn = ReactNoopFlightServer.render(<FunctionProp />, options);
|
||||
const symbol = ReactNoopFlightServer.render(<SymbolProp />, options);
|
||||
const refs = ReactNoopFlightServer.render(<RefProp />, options);
|
||||
|
||||
function Client({transport}) {
|
||||
return ReactNoopFlightClient.read(transport);
|
||||
|
@ -213,7 +218,11 @@ describe('ReactFlight', () => {
|
|||
);
|
||||
}
|
||||
|
||||
const data = ReactNoopFlightServer.render(<Server />);
|
||||
const data = ReactNoopFlightServer.render(<Server />, {
|
||||
onError(x) {
|
||||
// ignore
|
||||
},
|
||||
});
|
||||
|
||||
function Client({transport}) {
|
||||
return ReactNoopFlightClient.read(transport);
|
||||
|
|
|
@ -142,13 +142,17 @@ type Request = {
|
|||
// 500 * 1024 / 8 * .8 * 0.5 / 2
|
||||
const DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800;
|
||||
|
||||
function defaultErrorHandler(error: mixed) {
|
||||
console['error'](error); // Don't transform to our wrapper
|
||||
}
|
||||
|
||||
export function createRequest(
|
||||
children: ReactNodeList,
|
||||
destination: Destination,
|
||||
responseState: ResponseState,
|
||||
rootContext: FormatContext,
|
||||
progressiveChunkSize: number = DEFAULT_PROGRESSIVE_CHUNK_SIZE,
|
||||
onError: (error: mixed) => void = noop,
|
||||
onError: (error: mixed) => void = defaultErrorHandler,
|
||||
onCompleteAll: () => void = noop,
|
||||
onReadyToStream: () => void = noop,
|
||||
): Request {
|
||||
|
|
|
@ -91,7 +91,9 @@ export type Request = {
|
|||
|
||||
const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
||||
|
||||
function defaultErrorHandler() {}
|
||||
function defaultErrorHandler(error: mixed) {
|
||||
console['error'](error); // Don't transform to our wrapper
|
||||
}
|
||||
|
||||
export function createRequest(
|
||||
model: ReactModel,
|
||||
|
|
Loading…
Reference in New Issue