Exception: SampleRegistrar::RegistrationError

Inherits:
StandardError
  • Object
show all
Defined in:
app/models/sample_registrar.rb

Overview

Raised if the call to SampleRegistrar.register! fails for any reason, and so that calling code can get at the SampleRegistrar instances that were in the process of being created.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sample_registrars) ⇒ RegistrationError


20
21
22
# File 'app/models/sample_registrar.rb', line 20

def initialize(sample_registrars)
  @sample_registrars = sample_registrars
end

Instance Attribute Details

#sample_registrarsObject (readonly)

Returns the value of attribute sample_registrars


18
19
20
# File 'app/models/sample_registrar.rb', line 18

def sample_registrars
  @sample_registrars
end

Instance Method Details

#messageObject


24
25
26
# File 'app/models/sample_registrar.rb', line 24

def message
  "#{super}: #{registrar_errors}"
end

#registrar_errorsObject


28
29
30
# File 'app/models/sample_registrar.rb', line 28

def registrar_errors
  sample_registrars.map { |sr| sr.errors.full_messages }.flatten.join('; ')
end