Class: Diecut::ErrorHandling::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/diecut/errors.rb

Direct Known Subclasses

AllWarn, Reporter, Silent

Instance Method Summary collapse

Instance Method Details

#handle_exception(ex) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/diecut/errors.rb', line 36

def handle_exception(ex)
  if Error === ex
    issue(ex.message)
  else
    raise
  end
end

#invalid_plugin(name, context_path, value) ⇒ Object



28
29
30
# File 'lib/diecut/errors.rb', line 28

def invalid_plugin(name, context_path, value)
  issue invalid_plugin_message(name, context_path, value)
end

#invalid_plugin_message(name, context_path, value) ⇒ Object



12
13
14
# File 'lib/diecut/errors.rb', line 12

def invalid_plugin_message(name, context_path, value)
  "Default on #{context_path.inspect} from plugin #{name} has both a simple default value (#{value}) and a dynamic block value, which isn't allowed."
end

#missing_context_field(plugin_name, option_name, context_path) ⇒ Object



20
21
22
# File 'lib/diecut/errors.rb', line 20

def missing_context_field(plugin_name, option_name, context_path)
  issue(missing_context_field_message(option_name, context_path))
end

#missing_context_field_message(option_name, context_path) ⇒ Object



4
5
6
# File 'lib/diecut/errors.rb', line 4

def missing_context_field_message(option_name, context_path)
  "No template uses a value at #{context_path.inspect}, provided by #{option_name}"
end

#unregistered_plugin_source(source_path) ⇒ Object



32
33
34
# File 'lib/diecut/errors.rb', line 32

def unregistered_plugin_source(source_path)
  issue unregistered_plugin_source_message(source_path)
end

#unregistered_plugin_source_message(source_path) ⇒ Object



16
17
18
# File 'lib/diecut/errors.rb', line 16

def unregistered_plugin_source_message(source_path)
  "Couldn't find source of plugin which appears to be defined at #{source_path}"
end

#unused_default(plugin_name, context_path) ⇒ Object



24
25
26
# File 'lib/diecut/errors.rb', line 24

def unused_default(plugin_name, context_path)
  issue(usused_default_message(context_path))
end

#unused_default_message(context_path) ⇒ Object



8
9
10
# File 'lib/diecut/errors.rb', line 8

def unused_default_message(context_path)
  "No template uses a value at #{context_path.inspect}, provided as a default"
end