Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

fix: attach remaining non-enumerables to req #387

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

kamilogorek
Copy link
Contributor

@kamilogorek kamilogorek commented Oct 5, 2017

Ref: #375

An issue here is that Koa wraps request object, and those properties are not enumerable – https://github.com/koajs/koa/blob/master/docs/api/request.md

bodyparser middleware, attaches body to this.request object, not this.req, therefore we have to use former as the context for the error and we cannot just say this.request.req while calling it, eg.

Raven.captureException(err, {
  req: this.request.req,
}, (sendErr, eventId) => {
  if (sendErr) console.error('Failed to send captured exception to Sentry', err);
});

This will work, but will skip the body of a request, which we definitely don't want.

@kamilogorek kamilogorek requested a review from a team October 5, 2017 12:10
Copy link
Contributor

@MaxBittker MaxBittker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice that this was already abstracted 👍

@kamilogorek kamilogorek merged commit 5d8556a into master Oct 6, 2017
@kamilogorek kamilogorek deleted the attach-request-attrs branch October 6, 2017 09:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants