JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://cdn.foundation5.zurb.com/foundation.css">
<script src="http://cdn.foundation5.zurb.com/foundation.js"></script>
<button id="generateError">
Generate Error
</button>
<table id="listaErros">
<thead>
<tr>
<th>Error</th>
<th>URL</th>
<th>Line</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
CSS
#listaErros, #generateError {
width: 100%;
}
JavaScript
var generateError = document.getElementById("generateError");
var listaErros = document.getElementById("listaErros").querySelector("tbody");
generateError.onclick = function () {
geradorDeErro();
}
window.onerror = function(error, url, line) {
var linha = document.createElement("tr");
var celulas = {
error: document.createElement("td"),
url: document.createElement("td"),
line: document.createElement("td"),
}
celulas.error.innerHTML = error;
celulas.url.innerHTML = url;
celulas.line.innerHTML = line;
linha.appendChild(celulas.error);
linha.appendChild(celulas.url);
linha.appendChild(celulas.line);
listaErros.appendChild(linha);
};
console.log('teste');
geradorDeErro();
console.log('teste');