Skip to content

Exceptions with message set to nil cause Sentry.capture_error(e) to fail with NoMethodError: undefined method `byteslice' for nil:NilClass #1323

@ghost

Description

Describe the bug

Stripe gem has following class:

class StripeError < StandardError

which overrides StandardError initialize method with followng:

def initialize(message = nil, http_status: nil, http_body: nil,
                   json_body: nil, http_headers: nil, code: nil)

it overrides StandardError default behaviour of setting default exception message
to class name of the error.

Exceptions with message set to nil cause sentry-ruby gems method:

Sentry.capture_error(e)

to fail with
NoMethodError: undefined method `byteslice' for nil:NilClass

To Reproduce

Described above.

Expected behavior

Correct capture of exception.

Actual behavior

Described above.

Environment

  • Ruby Version: 2.7.2
  • SDK Version:

sentry-rails (4.2.2)
sentry-ruby (4.2.2)
sentry-ruby-core (4.2.2)
sentry-sidekiq (4.2.1)

  • Integration Versions (if any):

rails (6.1.3)
activejob (6.1.3)
sidekiq (6.1.3)

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions