0
votes

getting error "SyntaxError: Illegal continue statement: no surrounding iteration statement " I am using node js as server express 4.16.4

-----------------function definition-------------------

function createCSV(jsondata){
    return new Promise(function(resolve, reject){ //<----errorline
        jsondata = jsondata.replace(/DEGREE/g, '°');
        console.log(jsondata);
        jsondata = JSON.parse(jsondata);
            var machineid = jsondata["Machine ID"];
        var success = true;
        //validation of data
        console.log(format);........so on

------------call----------------

webapp.post('/json', function(req, res){

    createCSV(req.body).then(function(positive){ <----call

        res.send(JSON.stringify(positive));

    }).catch(function(err){

        console.log(err);
        res.send(JSON.stringify(err));

    });

});

----------------------Error-------------------------

SyntaxError: Illegal continue statement: no surrounding iteration statement at new Promise () at createCSV (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/server.js:295:9) at /home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/server.js:203:2 at Layer.handle [as handle_request] (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/layer.js:95:5) at next (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/layer.js:95:5) at /home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:335:12) at next (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:275:10) at /home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/server.js:138:2 at Layer.handle [as handle_request] (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:317:13) at /home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:335:12) at next (/home/cookie98/Dhruvin/Projects/Polyweld/zip/WebApp/node_modules/express/lib/router/index.js:275:10) {}

1
Please show the whole code. Probably there's a break or continue statement where it doesn't belongBergi

1 Answers

1
votes

Dhruvin modi's comment on a deleted answer:

ohh thanks a lot ...there was a spelling mistake "continuous" converted to "continue"