Created
January 2, 2017 16:00
-
-
Save tomat/547c5140462a948311160297735f7483 to your computer and use it in GitHub Desktop.
This file contains 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
(function() { | |
var errorBoxElement = false; | |
var showError = function(error) { | |
if (!errorBoxElement) { | |
errorBoxElement = document.createElement('div'); | |
errorBoxElement.style.position = 'absolute'; | |
errorBoxElement.style.top = '0'; | |
errorBoxElement.style.bottom = '0'; | |
errorBoxElement.style.left = '0'; | |
errorBoxElement.style.right = '0'; | |
errorBoxElement.style.background = 'rgba(255, 0, 0, 0.7)'; | |
errorBoxElement.style.zIndex = 1000000; | |
errorBoxElement.style.color = '#fff'; | |
errorBoxElement.style.padding = '10px'; | |
document.body.appendChild(errorBoxElement); | |
} | |
var errorLine = document.createElement('div'); | |
errorLine.innerHTML = error; | |
errorBoxElement.appendChild(errorLine); | |
}; | |
window.onerror = function(errorMsg, url, lineNumber) { | |
showError('Error: ' + errorMsg + ' Script: ' + url + ' Line: ' + lineNumber); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment