stefanzan分享 http://blog.sciencenet.cn/u/stefanzan

博文

Fundebug微信小程序错误监控插件更新至1.1.0,新增test()与notifyHttpError()方法

已有 1692 次阅读 2019-4-22 15:12 |个人分类:微信小程序|系统分类:科研笔记| 微信小程序, 小程序

摘要: 1.1.0新增fundebug.test()fundebug.notifyHttpError()方法,同时大小压缩至15K

Fundebug是专业的小程序BUG监控服务,可以第一时间为您捕获生存环境中小程序的异常、错误或者BUG,及时给开发者发送报警,帮助您快速修复BUG。欢迎大家免费试用,也欢迎各位用户反馈建议或者问题。

test(name, message)

使用 fundebug.test()方法可以用于测试 Fundebug 插件。

name: 错误名称,参数类型为字符串,默认值为”Test”

message: 错误信息,参数类型为字符串,默认值为”Hello, Fundebug!”

示例 1 : 没有参数

fundebug.test();

示例 2 : 带参数

fundebug.test("Hello", "This is a Test");

fundebug.test() 主要用于测试,它发送的错误每次都会报警邮件(每天的限额是 20 封),这样可能会给您造成困扰。为了避免重复报警,请使用其他 API 记录错误,这样同一个错误将只会在错误数达到阈值(10, 100, 100…)的时候报警。

notifyHttpError(req, res, option)

使用 notifyHttpError,可以将 HTTP 请求错误发送到 Fundebug。

req: HTTP 请求参数,参数类型为 Object,其子属性与wx.request的请求参数一致,如下:

  • method

  • url

  • data

  • header

  • dataType

  • responseType

res: HTTP 返回参数,参数类型为 Object,其子属性与wx.request的返回参数一致,如下:

  • statusCode

  • errMsg

  • data

  • header

option: 可选对象,参数类型为 Object,用于发送一些额外信息,比如:

  • metaData: 其他自定义信息

示例:

wx.request({
   method: "POST",
   url: "https://example.com/create",
   data: {
       test: "test"
   },
   success(res) {
       fundebug.notifyHttpError(
           {
               method: "POST",
               url: "https://example.com/create"
           },
           res
       );
   },
   fail(res) {
       fundebug.notifyHttpError(
           {
               method: "POST",
               url: "https://example.com/create"
           },
           res
       );
   }
});

最后,感谢 Fundebug 用户无事忙的反馈。

参考

关于Fundebug

Fundebug专注于JavaScript、微信小程序、微信小游戏、支付宝小程序、React Native、Node.js和Java线上应用实时BUG监控。 自从2016年双十一正式上线,Fundebug累计处理了10亿+错误事件,付费客户有Google、360、金山软件、百姓网等众多品牌企业。欢迎大家免费试用

版权声明

转载时请注明作者 Fundebug以及本文地址:
https://blog.fundebug.com/2019/04/19/fundebug-wechat-miniprogram-1-1-0/




https://blog.sciencenet.cn/blog-811611-1174866.html

上一篇:如何编写最佳的Dockerfile
下一篇:JavaScript 新语法详解:Class 的私有属性与私有方法
收藏 IP: 112.48.3.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 23:21

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部