调试Google Apps脚本Web App的有效方法 [英] Effective way to debug a Google Apps Script Web App

查看:107
本文介绍了调试Google Apps脚本Web App的有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我如何进行调试(例如查看变量值,步骤通过代码等)一个Web应用程序?在容器绑定脚本中,这很容易,因为我可以设置断点,使用应用程序脚本调试器 - 我如何在网页中查看这些信息,例如当我执行doPost?

解决方案

James Ferreira在他的优秀书籍Google脚本中倡导建立自己的开发环境,三个浏览器窗口;一个用于代码,一个用于实时视图(在发布,部署为Web应用程序时,您将获得一个最新代码链接,它将在刷新时将实时视图更新为最新保存),另一个用于电子表格它会记录错误(使用try / catch包裹你想要关注的代码)。

I have had some experience writing container-based apps scripts, but am totally new to web apps.

How do I debug (e.g. look at variable values, step through code etc) a web app? In a container bound script it was easy, because I could set breakpoints, use the apps script debugger - how do I go about this in a web page e.g. when I execute a doPost?

解决方案

In his excellent book "Google Script", James Ferreira advocates setting up your own development environment with three browser windows; one for the code, one for the live view (in Publish, Deploy as web app, you are provided with a "latest code" link that will update the live view to the latest save when it is refreshed), and one for a spreadsheet that logs errors (using try/catch wrapped around bits of code you want to keep an eye on).

这篇关于调试Google Apps脚本Web App的有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆