• 它是一个数组,数组中的元素为过滤规则,当错误符合数组中任意一条过滤规则时,则会被过滤
  • 过滤规则是JavaScript对象,该对象的Key为错误的属性名,Value为正则表达式(唯一的特例是”inexistence”);
  • 当错误的属性匹配对应正则表达式时,则会被过滤;
  • 当过滤规则的属性值为”inexistence”时,则会过滤某个属性不存在的错误;
  1. "name": "ReferenceError",
  2. "message": "b is not defined",
  3. "stack": "ReferenceError: b is not defined\n at http://127.0.0.1:14988/game/game.js:80:5\n at require (http://127.0.0.1:14988/game/__dev__/WAGame.js:3:13718)\n at http://127.0.0.1:14988/game/gamePage.html:149:5",
  4. "type": "caught",
  5. "metaData":
  6. {
  7. "name": "Fundebug",
  8. "nation": "China"
  9. },
  10. "notifierVersion": "0.2.0",
  11. "releaseStage": "development",
  12. "appVersion": "3.2.5",
  13. "systemInfo":
  14. {
  15. "errMsg": "getSystemInfo:ok",
  16. "model": "iPhone 5",
  17. "pixelRatio": 2,
  18. "windowWidth": 320,
  19. "system": "iOS 10.0.1",
  20. "language": "zh_CN",
  21. "version": "6.6.3",
  22. "screenWidth": 320,
  23. "screenHeight": 568,
  24. "SDKVersion": "2.0.9",
  25. "brand": "devtools",
  26. "fontSizeSetting": 16,
  27. "benchmarkLevel": 1,
  28. "batteryLevel": 100,
  29. "statusBarHeight": 20,
  30. "platform": "devtools"
  31. },
  32. "time": 1528937703693

示例1:过滤ReferenceError的错误

  1. fundebug.init(
  2. {
  3. apikey: "API-KEY",
  4. filters: [
  5. req:
  6. {
  7. url: /example\.com/,
  8. method: /^GET$/
  9. }
  10. }]
  11. });

示例3:过滤statusCode为401的HTTP请求错误

  1. fundebug.init(
  2. {
  3. apikey: "API-KEY",
  4. filters: [
  5. {
  6. name: /^ReferenceError$/,
  7. systemInfo:
  8. {
  9. "model": /^iPhone 5$/,
  10. }
  11. }]

示例5:配置多条过滤规则