Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 9e5cec6

Browse files
committed
update styling and presentation of error messages
1 parent 94f0a09 commit 9e5cec6

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

lib/engine_underscore.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@
2222

2323
var _ = require('underscore');
2424
var partialRegistry = {};
25+
var errorStyling = `
26+
<style>
27+
body {
28+
background: linear-gradient(to bottom, #f1f1f1 0%,#ffffff 60%);
29+
color: #444;
30+
padding: 30px;
31+
}
32+
h1 {
33+
font-size: 16pt;
34+
color: #733;
35+
background: #fcfcfc;
36+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
37+
padding: 17px 30px;
38+
margin: -30px -30px 0 -30px;
39+
}
40+
dt { font-weight: bold; }
41+
</style>
42+
`;
2543

2644
// extend underscore with partial-ing methods and other necessary tooling
2745
// HANDLESCORE! UNDERBARS!
@@ -100,9 +118,16 @@ var engine_underscore = {
100118
_partials: partials
101119
}));
102120
} catch (e) {
103-
var errorMessage = `Error in underscore template ${pattern.patternName} (${pattern.relPath}): [${e.toString()}]`;
121+
var errorMessage = `Error rendering underscore pattern "${pattern.patternName}" (${pattern.relPath}): [${e.toString()}]`;
104122
console.log(errorMessage);
105-
renderedHTML = `<h1>Error in underscore template ${pattern.patternName} (${pattern.relPath})</h1><p>${e.toString()}</p>`;
123+
renderedHTML = `${errorStyling}
124+
<h1>Error rendering underscore pattern "${pattern.patternName}"</h1>
125+
<dl>
126+
<dt>Message</dt><dd>${e.toString()}</dd>
127+
<dt>Partial name</dt><dd>${pattern.patternName}</dd>
128+
<dt>Template path</dt><dd>${pattern.relPath}</dd>
129+
</dl>
130+
`;
106131
}
107132

108133
return renderedHTML;

0 commit comments

Comments
 (0)