-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove.txt
54 lines (39 loc) · 1.69 KB
/
remove.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// const { title } = require('process');
// const { listingSchema } = require("./schema.js");
// const { reviewSchema } = require("./schema.js");
// const Review = require('./models/review.js')
// app.all("*", (req, res, next)=>{
// next(new ExpressError("Page Not Found", 404));
// })
// app.all("*", (req, res, next) => {
// next(new ExpressError("Page Not Found"));
// });
// app.all("*", (req, res, next) => {
// const err = new ExpressError("Page Not Found");
// // Log the status code before throwing the error
// console.log('Status Code before throwing:', err.statusCode);
// next(err);
// });
// app.use((err, req, res, next) => {
// console.log('Error handler middleware reached:', err);
// // Check if the status code is a number
// if (typeof err.statusCode === 'number') {
// console.log('Status Code:', err.statusCode);
// res.status(err.statusCode).render("./listings/Error.ejs", { err });
// } else {
// console.log('Status Code is not a number:', err.statusCode);
// res.status(500).render("./listings/Error.ejs", { err });
// }
// });
// app.use((err, req, res, next) => {
// console.log('Error handler middleware reached:', err);
// // Use the status method to set the HTTP response status
// res.status(err.statusCode || 500).render("./listings/Error.ejs", { err });
// });
// app.all("*", (req, res, next) => {
// // Set the status code when creating an instance of ExpressError
// const err = new ExpressError("Page Not Found", 404);
// // Log the status code before throwing the error
// console.log('Status Code before throwing:', err.statusCode);
// // next(err);
// });