Class: SpecForge::Error::InvalidStructureError

Inherits:
Error
  • Object
show all
Defined in:
lib/spec_forge/error.rb

Overview

Raised when a YAML structure doesn't match expectations Acts as a container for multiple validation errors

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ InvalidStructureError

Returns a new instance of InvalidStructureError.



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/spec_forge/error.rb', line 211

def initialize(errors)
  message = errors.to_a.join_map("\n") do |error|
    next error if error.is_a?(SpecForge::Error)

    # Normal errors, let's get verbose
    backtrace = SpecForge.backtrace_cleaner.clean(error.backtrace)
    "#{error.inspect}\n  # ./#{backtrace.join("\n  # ./")}\n"
  end

  super(message)
end