0

I've un other problem, with my google apps scpript, now html, css, and js files are ok. But when I call a function

.gs
function func(){
  var message="";
  try {
   
    );
  }
  catch (error) {
     message="Errors "+ 
      "\r\nMessage: " + error.message
      + "\r\nFile: " + error.fileName
      + "\r\nLine: " + error.lineNumber;
  }
  finally {
    if(message=="") {
      message="Completed Successfully";
    }
    Logger.log(message);
  }
}

with

.js
function onFailure(error){
    console.log("onFailure: " + error);
}

function onSuccess(resp) {
    console.log("onSuccess: "+ resp);
}
google.script.run.withFailureHandler(onFailure).withSuccessHandler(onSuccess).func();

the console show this logs, and not my

Net state changed from IDLE to BUSY
Net state changed from BUSY to IDLE
null

I just try to follow much video but I can't see the error. I don't understand where I'm wrong, please help me :’(.

new name
  • 15,861
  • 19
  • 68
  • 114

1 Answers1

0

Posting this for documentation purposes.

As mentioned by Tanaike in comments, you need to add return message to your function if you want to actually return the value (ref: return).

Regarding Net state changed from IDLE to BUSY, see this question.

Iamblichus
  • 18,540
  • 2
  • 11
  • 27