Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't truncate a non-existent message property on data #647

Merged
merged 1 commit into from
Jul 8, 2016

Conversation

dhritzkiv
Copy link
Contributor

@dhritzkiv dhritzkiv commented Jul 8, 2016

"Cannot read property 'length' of undefined when capturing exception" with undefined message when trying to capture an exception with a data object (second argument) that contains no data. For example:

raven.captureException(new Error("foo"), {
    level: "warning",
    extra: {
        foo: "bar"
    }
});

Causes the Raven script to throw an exception because data.message is undefined and truncate only works with strings.


This should prevent this from happening.


This change is Reviewable

@benvinegar
Copy link
Contributor

Damn, thanks for catching this – and right before we put out 3.2.1 too. I'll update that release w/ this patch.

@benvinegar
Copy link
Contributor

Note that this bug also requires you to set maxMessageLength in Raven.config – it's 0 by default, and if it's 0 it skips accessing undefined.length.

@benvinegar
Copy link
Contributor

Merging – I've also added a test that I'll land on top.

@benvinegar benvinegar merged commit f4c4499 into getsentry:master Jul 8, 2016
benvinegar added a commit that referenced this pull request Jul 8, 2016
@benvinegar
Copy link
Contributor

See also 31d99f9

benvinegar added a commit that referenced this pull request Jul 8, 2016
benvinegar added a commit that referenced this pull request Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants