Commit 8a72a314 authored by Jared Palmer's avatar Jared Palmer Committed by Dan Abramov
Browse files

Make error overlay filename configurable (#3028)

* Make error overlay file configurable

* Add fallback filename
parent 6644054f
Showing with 8 additions and 3 deletions
+8 -3
...@@ -33,6 +33,7 @@ ErrorOverlay.startReportingRuntimeErrors({ ...@@ -33,6 +33,7 @@ ErrorOverlay.startReportingRuntimeErrors({
module.hot.decline(); module.hot.decline();
} }
}, },
filename: 'static/js/bundle.js',
}); });
if (module.hot && typeof module.hot.dispose === 'function') { if (module.hot && typeof module.hot.dispose === 'function') {
......
...@@ -21,6 +21,7 @@ import type { ErrorRecord } from './listenToRuntimeErrors'; ...@@ -21,6 +21,7 @@ import type { ErrorRecord } from './listenToRuntimeErrors';
type RuntimeReportingOptions = {| type RuntimeReportingOptions = {|
onError: () => void, onError: () => void,
launchEditorEndpoint: string, launchEditorEndpoint: string,
filename?: string,
|}; |};
let iframe: null | HTMLIFrameElement = null; let iframe: null | HTMLIFrameElement = null;
...@@ -55,7 +56,7 @@ export function startReportingRuntimeErrors(options: RuntimeReportingOptions) { ...@@ -55,7 +56,7 @@ export function startReportingRuntimeErrors(options: RuntimeReportingOptions) {
} finally { } finally {
handleRuntimeError(errorRecord); handleRuntimeError(errorRecord);
} }
}); }, options.filename);
} }
function handleRuntimeError(errorRecord) { function handleRuntimeError(errorRecord) {
......
...@@ -39,7 +39,10 @@ export type ErrorRecord = {| ...@@ -39,7 +39,10 @@ export type ErrorRecord = {|
stackFrames: StackFrame[], stackFrames: StackFrame[],
|}; |};
export function listenToRuntimeErrors(crash: ErrorRecord => void) { export function listenToRuntimeErrors(
crash: ErrorRecord => void,
filename: string = '/static/js/bundle.js'
) {
function crashWithFrames(error: Error, unhandledRejection = false) { function crashWithFrames(error: Error, unhandledRejection = false) {
getStackFrames(error, unhandledRejection, CONTEXT_SIZE) getStackFrames(error, unhandledRejection, CONTEXT_SIZE)
.then(stackFrames => { .then(stackFrames => {
...@@ -68,7 +71,7 @@ export function listenToRuntimeErrors(crash: ErrorRecord => void) { ...@@ -68,7 +71,7 @@ export function listenToRuntimeErrors(crash: ErrorRecord => void) {
{ {
message: data.message, message: data.message,
stack: data.stack, stack: data.stack,
__unmap_source: '/static/js/bundle.js', __unmap_source: filename,
}, },
false false
); );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment