Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Skip opening devtools when programming mithril
/*
error method makes it so i don't have to open up dev tools to see what went wrong.
must be in different <script> from your app code.
I use it in combination with Auto Reload https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api
*/
window.onerror = function(msg, url, line, col, error) {
m.render(document,
m("html", [
m("body", [
m("table", [
m("tr", [
m("td", "url"),
m("td", url)
]),
m("tr", [
m("td", "Message"),
m("td", msg)
]),
m("tr", [
m("td", "Line number"),
m("td", line)
]),
m("tr", [
m("td", "Column"),
m("td", col)
]),
m("tr", [
m("td", "Error"),
m("td", error)
])
])
])
])
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment