news-catalyst / google-app-scripts

a collection of scripts for tinynews google docs add-ons
https://script.google.com/a/newscatalyst.org/d/1ILURq69o3cYUy6k1n1X6HwxdMfl9xWNhILYuZxgLfeblb3IR15WCMZSj/edit
1 stars 1 forks source link

Add more context to error reporting in AirBrake #403

Closed jacqui closed 2 years ago

jacqui commented 2 years ago

Some of the errors reported have enough context that I can figure out who triggered it (as in what org, which greatly helps debugging efforts), but others offer very few contextual clues.

For instance, this "Document must be in the right folder..." error confounds me a bit - as in why does it keep happening, I thought everyone was set up properly with the folder structure - so I'd like to confirm if it's a legit error or if there's a bug in the code. The context only includes the following, which would be more helpful if it included things like the TNC Org Slug and incorrect folder structure, for instance:

{
  "environment": "production",
  "history": [
    {
      "date": "2022-01-24T19:18:45.357Z",
      "duration": "101",
      "method": "GET",
      "statusCode": "200",
      "type": "xhr",
      "url": "https://notifier-configs.airbrake.io/2020-06-18/config/370377/config.json?&notifier_name=airbrake-js%2Fbrowser&notifier_version=2.1.7&os=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F97.0.4692.99%20Safari%2F537.36&language=JavaScript"
    },
    {
      "arguments": [
        "onFailure error:",
        "Documents must be in the right folder to be published: orgName/articles (and subfolders) for articles and orgName/pages for static pages (like About or Contact); please move this document and try again."
      ],
      "date": "2022-01-24T19:18:50.847Z",
      "severity": "log",
      "type": "log"
    }
  ],
  "language": "JavaScript",
  "messageParams": {
    "0": "orgName/articles",
    "1": "(and subfolders)",
    "2": "orgName/pages",
    "3": "(like About or Contact)"
  },
  "messagePattern": "Documents must be in the right folder to be published: {} {} for articles and {} for static pages {}; please move this document and try again.",
  "notifier": {
    "name": "airbrake-js/browser",
    "url": "https://github.com/airbrake/airbrake-js/tree/master/packages/browser",
    "version": "2.1.7"
  },
  "orgSlug": "",
  "remoteAddr": "98.236.85.155",
  "remoteCountry": "United States",
  "remoteCountryCode": "US",
  "rootDirectory": "https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com",
  "severity": "error",
  "sourceMapErrors": {
    "https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com/static/macros/client/js/2280000860-mae_html_user_bin_i18n_mae_html_user.js": "http.Get url=\"https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com/static/macros/client/js/2280000860-mae_html_user_bin_i18n_mae_html_user.map\": got 404 Not Found, expected 200 OK",
    "https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com/userCodeAppPanel": "http.Get url=\"https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com/userCodeAppPanel.map\": got 404 Not Found, expected 200 OK"
  },
  "url": "https://n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com/userCodeAppPanel",
  "urlInfo": {
    "host": "n-s4vshwzfwlvnqx56yk3pzvazbnucuytmjbpbiga-1lu-script.googleusercontent.com",
    "path": "/userCodeAppPanel",
    "query": {},
    "scheme": "https"
  },
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36",
  "userAgentInfo": {
    "browserName": "Chrome",
    "browserVersion": "97.0.4692.99",
    "engineName": "AppleWebKit",
    "engineVersion": "537.36",
    "isBot": false,
    "isMobile": false,
    "os": "Intel Mac OS X 10_15_7",
    "platform": "Macintosh"
  }
}