initial release
[squeep-api-dingus] / lib / template / error-html.js
1 'use strict';
2
3 module.exports = (err) => {
4 const detailsArr = Array.isArray(err.details) ? err.details : [ err.details ];
5 return `<!DOCTYPE html>
6 <html lang="en">
7 <head>
8 <title>${err.statusCode} ${err.errorMessage}</title>
9 </head>
10 <body>
11 <h1>${err.errorMessage}</h1>` +
12 (!err.details ? '' : detailsArr.map((d) => `\n <p>${d}</p>`).join('')) + `
13 </body>
14 </html>`;
15 };