Sentry-javascript: captureException or captureMessage drops off object info

Created on 12 Dec 2018  ·  3Comments  ·  Source: getsentry/sentry-javascript

This may be a newbie question but I want to add logs in captureMessage and captureException with JSON.stringify(API_responseObj).
The API_responseObj is trimmed off after some text in fingerprint & logentry message obj.
If same is added by console.log than message obj is having complete info, may be as logger is console.
Can you give a way where i can add a complete response object to Sentry log in string format without looping through all it's keys, something like JSON.stringify(OBJ) to print complete object.

Thanks.

Question

Most helpful comment

Hey Kamil,

I will add that with setExtra. Thanks for clarifying it.

Regards,
Kishor

On Wed 12 Dec, 2018, 3:39 PM Kamil Ogórek, notifications@github.com wrote:

Hey @kishor-bhatt https://github.com/kishor-bhatt, you can do this
using extra context –
https://docs.sentry.io/enriching-error-data/context/?platform=javascript

Sentry.withScope((scope) => {

scope.setExtra("response", API_responseObj);

Sentry.captureException(err);

});


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/getsentry/sentry-javascript/issues/1794#issuecomment-446533014,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQIaZTKfeiOdvQhli3awbC6Lu6iDi9jiks5u4NXwgaJpZM4ZPDwn
.

All 3 comments

Hey @kishor-bhatt, you can do this using extra context – https://docs.sentry.io/enriching-error-data/context/?platform=javascript

Sentry.withScope((scope) => {
  scope.setExtra("response", API_responseObj);
  Sentry.captureException(err);
});

Hey Kamil,

I will add that with setExtra. Thanks for clarifying it.

Regards,
Kishor

On Wed 12 Dec, 2018, 3:39 PM Kamil Ogórek, notifications@github.com wrote:

Hey @kishor-bhatt https://github.com/kishor-bhatt, you can do this
using extra context –
https://docs.sentry.io/enriching-error-data/context/?platform=javascript

Sentry.withScope((scope) => {

scope.setExtra("response", API_responseObj);

Sentry.captureException(err);

});


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/getsentry/sentry-javascript/issues/1794#issuecomment-446533014,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQIaZTKfeiOdvQhli3awbC6Lu6iDi9jiks5u4NXwgaJpZM4ZPDwn
.

Anytime!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karolisdzeja picture karolisdzeja  ·  36Comments

daangeerdink picture daangeerdink  ·  31Comments

danse picture danse  ·  27Comments

abraxxas picture abraxxas  ·  50Comments

OliverJAsh picture OliverJAsh  ·  41Comments