更新时间:2023-03-03 GMT+08:00
分享

调试

本章节介绍调试、日志代码的规则。

  • try、catch

    不需要做统一异常处理时,都不用写try、catch语句,只需抛出统一的错误码。

    【推荐】:

    if (input.customerId == "") {
           context.throwError("STO-001003");
    };

    【不推荐】:

    if (input.customerId == "") {
           context.setError('STO-001003', 'You have not login or the session has expired, please
    login again.');
           return;
    };
  • 打印日志(Console.log())

    根据业务场景需要,来控制打印日志语句,建议一个脚本最多不要超过三个打印日志语句。

  • 最终归档时,脚本不要有调试代码。
分享:

    相关文档

    相关产品