Skip to content

Commit

Permalink
Update server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna-devv authored Aug 26, 2022
1 parent c0a2b8a commit 32bf290
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ export async function requestManager(req, res) {
};

export async function onError(err, req, res) {
res.writeHead(500, {
'Content-Type': 'text/html'
});
const html_500 = fs.readFileSync(path.join(__dirname, '../html/500.html'), 'utf-8')
return res.end(html_500.replace(/{host}/g, req.headers.host));
try {
res.writeHead(500, {
'Content-Type': 'text/html'
});
const html_500 = fs.readFileSync(path.join(__dirname, '../html/500.html'), 'utf-8')
return res.end(html_500.replace(/{host}/g, req.headers.host));
} catch { return }
}

0 comments on commit 32bf290

Please sign in to comment.