Skip to content
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
Prev Previous commit
Next Next commit
Prettier output
  • Loading branch information
gaearon committed May 13, 2017
commit 4cb6be38572d4250f9498c4a1d156eb5875a4c15
7 changes: 5 additions & 2 deletions packages/react-error-overlay/src/components/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ function createOverlay(
finalMessage = finalMessage
// TODO: maybe remove this prefix from fbjs?
// It's just scaring people
.replace('Invariant Violation: ', '')
.replace(/^Invariant Violation:\s*/, '')
// This is not helpful either:
.replace(/^Warning:\s*/, '')
// Break the actionable part to the next line.
// AFAIK React 16+ should already do this.
.replace(' Check the render method', '\n\nCheck the render method');
.replace(' Check the render method', '\n\nCheck the render method')
.replace(' Check your code at', '\n\nCheck your code at');

// Put it in the DOM
header.appendChild(document.createTextNode(finalMessage));
Expand Down
4 changes: 1 addition & 3 deletions packages/react-error-overlay/src/utils/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ function massage(
frames: ReactFrame[]
): { message: string, stack: string } {
let message = stripInlineStacktrace(warning);
if (message.indexOf('Warning: ') === 0) {
message = message.substring('Warning: '.length);
}

// Reassemble the stack with full filenames provided by React
let stack = '';
for (let index = 0; index < frames.length; ++index) {
const { fileName, lineNumber } = frames[index];
Expand Down