Module: CfnDsl::Errors

Defined in:
lib/cfndsl/errors.rb

Overview

Keeps track of errors

Class Method Summary collapse

Class Method Details

.clearObject



17
18
19
# File 'lib/cfndsl/errors.rb', line 17

def self.clear
  @errors = []
end

.error(err, idx = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/cfndsl/errors.rb', line 6

def self.error(err, idx = nil)
  if idx.nil?
    @errors.push(err + "\n" + caller.join("\n") + "\n")
  else
    m = caller[idx].match(/^.*?:\d+:/)
    err_loc = m ? m[0] : caller[idx]

    @errors.push(err_loc + ' ' + err + "\n")
  end
end

.errorsObject



21
22
23
# File 'lib/cfndsl/errors.rb', line 21

def self.errors
  @errors
end

.errors?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/cfndsl/errors.rb', line 25

def self.errors?
  !@errors.empty?
end