UNPKG

589 BPlain TextView Raw
1/**
2 * Prints a warning in the console if it exists.
3 *
4 * @param message The warning message.
5 */
6export default function warning(message: string): void {
7 /* eslint-disable no-console */
8 if (typeof console !== 'undefined' && typeof console.error === 'function') {
9 console.error(message)
10 }
11 /* eslint-enable no-console */
12 try {
13 // This error was thrown as a convenience so that if you enable
14 // "break on all exceptions" in your console,
15 // it would pause the execution at this line.
16 throw new Error(message)
17 } catch (e) {} // eslint-disable-line no-empty
18}