Skip to content

Instantly share code, notes, and snippets.

@eliihen
Created May 10, 2018 12:37
Show Gist options
  • Select an option

  • Save eliihen/92a91c989c62b7d8d21e44eae917b890 to your computer and use it in GitHub Desktop.

Select an option

Save eliihen/92a91c989c62b7d8d21e44eae917b890 to your computer and use it in GitHub Desktop.

Revisions

  1. @esphen esphen created this gist May 10, 2018.
    9 changes: 9 additions & 0 deletions throw-on-prop-type-error.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const originalConsoleError = console.error;

    console.error = message => {
    if (/(Failed prop type)/.test(message)) {
    throw new Error(message);
    }

    originalConsoleError(message);
    };