Sign In Register

How can we help you today?

Start a new topic
Answered

Stop script execution

Hello, 


Is there a way to stop a script execution before the end of the script? (like exit in some other script languages)


Best Regards,

Sasha


Best Answer

Hi Sasha,


You can use a throw in Cloud Code to stop a script at a certain point. In your Cloud Code script if a certain condition isn't met you could use the following to stop the script at that point.

 

 throw "Your Error Here";

 

Hope that helps, if you have any further questions just let me know.


Thanks,

Liam




Answer

Hi Sasha,


You can use a throw in Cloud Code to stop a script at a certain point. In your Cloud Code script if a certain condition isn't met you could use the following to stop the script at that point.

 

 throw "Your Error Here";

 

Hope that helps, if you have any further questions just let me know.


Thanks,

Liam



Thanks Liam, this is what I was looking for.

Is there a way to throw without logging an error to Mongo?

Login to post a comment