Skip to content

NoMethodError: undefined method `byteslice' for []:Array #907

Description

@ericproulx

Hello,

Sidekiq integrations calls Raven.capture_exception like this:

 Raven.capture_exception(
        ex,
        :message => ex.message,
        :extra => { :sidekiq => context }
      )

Unfortunately, if ex.message isn't a String (in our case, it was a Hash), it fails with NoMethodError: undefined method `byteslice' for []:Array

I know it's weird that ex.message isn't a String, but it works when calling it like this :

# ex is an exception
Raven.capture_exception(ex)

When looking at code, event.message is interpolated properly only if Raven.capture_exception wasn't call with options message

# lib/raven/event.rb

def self.from_exception(exc, options = {}, &block)
      ...
      new(options) do |evt|
        evt.message = "#{exc.class}: #{exc.message}" # interpolated properly

        evt.add_exception_interface(exc)

        yield evt if block
      end
    end

Is it a bug ? I don't know, but I had to to_s my value before raising an exception.

Thanks

Metadata

Metadata

Assignees

Labels

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions