Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
round2314
New Member

error handler Unexpected block statement surrounding arrow body

Jump to solution

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
        }
    })
})

 

Labels (2)
0 Kudos
1 Solution

Accepted Solutions
cstrikwerda
Instructure
Instructure

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.

View solution in original post

1 Reply
cstrikwerda
Instructure
Instructure

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.