<commit_before>const release = require('./package.json').version

if (process.env.RAVEN_DSN) {
  var Raven = require('raven')
  Raven.config(process.env.RAVEN_DSN, {release}).install()
}

const url = require('url')
const { send } = require('micro')

const { parse } = require('./parser')
const { InvalidInputError } = require('./errors')

const exampleLink = (host) => `http://${host}/?feed=https://rolflekang.com/feed.xml`

module.exports = async (req, res) => {
  const { query } = url.parse(req.url, true)
  try {
    if (!query.feed) {
      return { usage: exampleLink(req.headers.host) }
    }

    if (typeof query.feed !== 'string') {
      throw new InvalidInputError()
    }

    return await parse(query.feed)
  } catch (error) {
    if (process.env.RAVEN_DSN) {
      Raven.captureException(error, {
        extra: {query}
      })
    }
    send(res, error.statusCode || 500, { error: error.constructor.name })
    console.error(error)
  }
}<commit_msg>fix: Add url to raven extra info<commit_after>const release = require('./package.json').version

if (process.env.RAVEN_DSN) {
  var Raven = require('raven')
  Raven.config(process.env.RAVEN_DSN, {release}).install()
}

const url = require('url')
const { send } = require('micro')

const { parse } = require('./parser')
const { InvalidInputError } = require('./errors')

const exampleLink = (host) => `http://${host}/?feed=https://rolflekang.com/feed.xml`

module.exports = async (req, res) => {
  const { query } = url.parse(req.url, true)
  try {
    if (!query.feed) {
      return { usage: exampleLink(req.headers.host) }
    }

    if (typeof query.feed !== 'string') {
      throw new InvalidInputError()
    }

    return await parse(query.feed)
  } catch (error) {
    if (process.env.RAVEN_DSN) {
      Raven.captureException(error, {
        extra: {query, url: req.url}
      })
    }
    send(res, error.statusCode || 500, { error: error.constructor.name })
    console.error(error)
  }
}
{'fraction_non_alphanumeric': 0.17201017811704836, 'fraction_numerical': 0.0030534351145038168, 'mean_word_length': 3.2370689655172415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '578471', 'n_tokens_mistral': 677, 'n_tokens_neox': 653, 'n_words': 134}