class Parallel::ExceptionWrapper

def initialize(exception)

def initialize(exception)
  # Remove the bindings stack added by the better_errors gem,
  # because it cannot be marshalled
  if exception.instance_variable_defined? :@__better_errors_bindings_stack
    exception.send :remove_instance_variable, :@__better_errors_bindings_stack
  end
  @exception =
    begin
      Marshal.dump(exception) && exception
    rescue StandardError
      UndumpableException.new(exception)
    end
end