CA
Crawlee & Apify10mo ago
correct-apricot

Using return and Actor.exit()

I wrote a function that needs to return it's result and will like to find out how to do that since I also have to call exit which terminates the function.
await Actor.init();
function funWithReturnStatement() {
// do some stuff
return data;
await Actor.exit()
}
await Actor.init();
function funWithReturnStatement() {
// do some stuff
return data;
await Actor.exit()
}
2 Replies
correct-apricot
correct-apricot10mo ago
Hello, what do you intend to return the data to? If you have a return on the top level, it do you want to return an exit code for the process, or what is the purpose of it?
fascinating-indigo
fascinating-indigo9mo ago

Did you find this page helpful?