Created
March 9, 2017 17:12
-
-
Save Alex1990/f8b6c0789427f7668b19f891f947a69c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prints a warning in the console if it exists. | |
* | |
* @param {String} message The warning message. | |
* @returns {void} | |
*/ | |
export default function warning(message) { | |
/* eslint-disable no-console */ | |
if (typeof console !== 'undefined' && typeof console.error === 'function') { | |
console.error(message) | |
} | |
/* eslint-enable no-console */ | |
try { | |
// This error was thrown as a convenience so that if you enable | |
// "break on all exceptions" in your console, | |
// it would pause the execution at this line. | |
throw new Error(message) | |
/* eslint-disable no-empty */ | |
} catch (e) { } | |
/* eslint-enable no-empty */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment