Skip to content

Instantly share code, notes, and snippets.

@kiy0taka
Created May 29, 2012 09:02
Show Gist options
  • Save kiy0taka/2823424 to your computer and use it in GitHub Desktop.
Save kiy0taka/2823424 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>Grails Runtime Exception</title>
<meta name="layout" content="main">
<link rel="stylesheet" href="${resource(dir: 'css', file: 'errors.css')}" type="text/css">
</head>
<body>
<g:renderException exception="${exception}" />
<script>
function xpath(path, node) {
node = node || document
var s = document.evaluate(path, node, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null)
var r = []
for (var i=0,n=s.snapshotLength; i<n; i++) {
r.push(s.snapshotItem(i))
}
return r
}
var userHome = "${System.properties.'user.dir'}"
xpath('//h2[./span[@class="filename"]]').forEach(function(h2) {
var filepath = userHome + '/' + xpath('./span[@class="filename"]', h2)[0].textContent
xpath('./following-sibling::pre//code[@class="line error"]', h2).forEach(function(err) {
err.addEventListener('click', function() {
var line = xpath('./span[@class="lineNumber"]', err)[0].textContent.replace(/:/, '')
location.href='txmt://open/?url=file://'+filepath+'&line='+line
})
})
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment