Exception: Sequel::NoMatchingRow

Inherits:
Error show all
Defined in:
lib/sequel/exceptions.rb

Overview

Error raised when the user requests a record via the first! or similar method, and the dataset does not yield any rows.

Instance Attribute Summary collapse

Attributes inherited from Error

#wrapped_exception

Instance Method Summary collapse

Methods inherited from Error

#cause

Constructor Details

#initialize(msg = nil) ⇒ NoMatchingRow

If the first argument is a Sequel::Dataset, set the dataset related to the exception to that argument, instead of assuming it is the exception message.


95
96
97
98
99
100
101
# File 'lib/sequel/exceptions.rb', line 95

def initialize(msg=nil)
  if msg.is_a?(Sequel::Dataset)
    @dataset = msg
    msg = nil
  end
  super
end

Instance Attribute Details

#datasetObject

The dataset that raised this NoMatchingRow exception.


91
92
93
# File 'lib/sequel/exceptions.rb', line 91

def dataset
  @dataset
end