Created
May 2, 2020 11:43
-
-
Save sreetamdas/ebdbf9300c7533fdce119a8af0997234 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
const clipp = (error) => { | |
const looksLike = "Looks like you've encountered the following error:"; | |
const largeFont = "font-size: 2em;"; | |
const resetFont = "font-size: unset;"; | |
const redText = "color: red;"; | |
const resetText = "color: unset;"; | |
const createOutline = char => { | |
return char.repeat((Math.max(error.message.length), looksLike.length) / 1.66) | |
} | |
console.warn(` | |
%c /${createOutline("-")}%c | |
%c☠️ <%c ${looksLike} | |
%c |%c | |
%c |%c %c${error.message}%c | |
%c |%c | |
%c |%c Here's the stack trace: | |
%c \\${createOutline("_")}%c | |
`, | |
largeFont, resetFont, | |
largeFont, resetFont, | |
largeFont, resetFont, redText, resetText, | |
largeFont, resetFont, | |
largeFont, resetFont, | |
) | |
console.groupCollapsed("⤵️Stack trace"); | |
console.error(error.stack) | |
console.groupEnd() | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment