Exception: RockBooks::AccountNotFoundError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/rock_books/errors/account_not_found_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, journal_entry_context) ⇒ AccountNotFoundError

Returns a new instance of AccountNotFoundError.



9
10
11
12
13
# File 'lib/rock_books/errors/account_not_found_error.rb', line 9

def initialize(code, journal_entry_context)
  self.code = code
  self.journal_entry_context = journal_entry_context
  super(to_s)
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



7
8
9
# File 'lib/rock_books/errors/account_not_found_error.rb', line 7

def code
  @code
end

#journal_entry_contextObject

Returns the value of attribute journal_entry_context.



7
8
9
# File 'lib/rock_books/errors/account_not_found_error.rb', line 7

def journal_entry_context
  @journal_entry_context
end

Instance Method Details

#to_sObject



16
17
18
19
# File 'lib/rock_books/errors/account_not_found_error.rb', line 16

def to_s
  ctx = journal_entry_context
  "Account code '#{code}' in journal '#{ctx.journal.short_name}', line ##{ctx.linenum} not found in chart of accounts. Line: '#{ctx.line}'"
end