Skip to content

Instantly share code, notes, and snippets.

@sreetamdas
Created May 2, 2020 11:43
Show Gist options
  • Save sreetamdas/ebdbf9300c7533fdce119a8af0997234 to your computer and use it in GitHub Desktop.
Save sreetamdas/ebdbf9300c7533fdce119a8af0997234 to your computer and use it in GitHub Desktop.
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