error handler Unexpected block statement surrounding arrow body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2021
12:54 AM
I'm following a node/express course and the instructure has written the below error handler code and I get the error:
Unexpected block statement surrounding arrow body; move the returned value immediately after the =>
.eslintarrow-body-style
Any ideas how to fix it?
const catchAsync = fn => {
return (req, res, next) => {
fn(req, res, next).catch(next)
}
}
exports.createTour = catchAsync(async (req, res, next) => {
const newTour = await Tour.create(req.body);
res.status(201).json({
status: 'success',
data: {
tour: newTour
}
})
})
Solved! Go to Solution.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022
01:20 PM
Hello round2314,
This error seems to be related to JavaScript. Being in the Canvas Community we can answer questions related to Canvas, although it seems your questions is a little outside of our scope. I would recommend to ask your instructor for questions related to the course material.