Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error overlay filename configurable #3028

Merged
merged 2 commits into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-dev-utils/webpackHotDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ErrorOverlay.startReportingRuntimeErrors({
module.hot.decline();
}
},
filename: 'static/js/bundle.js',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is missing a slash (still works but I'll fix it).

});

if (module.hot && typeof module.hot.dispose === 'function') {
Expand Down
3 changes: 2 additions & 1 deletion packages/react-error-overlay/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { ErrorRecord } from './listenToRuntimeErrors';
type RuntimeReportingOptions = {|
onError: () => void,
launchEditorEndpoint: string,
filename: string,
|};

let iframe: null | HTMLIFrameElement = null;
Expand Down Expand Up @@ -55,7 +56,7 @@ export function startReportingRuntimeErrors(options: RuntimeReportingOptions) {
} finally {
handleRuntimeError(errorRecord);
}
});
}, options.filename);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep backward compat for a bit, can you add a fallback here?

}

function handleRuntimeError(errorRecord) {
Expand Down
7 changes: 5 additions & 2 deletions packages/react-error-overlay/src/listenToRuntimeErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export type ErrorRecord = {|
stackFrames: StackFrame[],
|};

export function listenToRuntimeErrors(crash: ErrorRecord => void) {
export function listenToRuntimeErrors(
crash: ErrorRecord => void,
filename: string
) {
function crashWithFrames(error: Error, unhandledRejection = false) {
getStackFrames(error, unhandledRejection, CONTEXT_SIZE)
.then(stackFrames => {
Expand Down Expand Up @@ -68,7 +71,7 @@ export function listenToRuntimeErrors(crash: ErrorRecord => void) {
{
message: data.message,
stack: data.stack,
__unmap_source: '/static/js/bundle.js',
__unmap_source: filename,
},
false
);
Expand Down