Module: Card::Set::All::Error::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod008-card-mod-format/all/error.rb,
card/tmpsets/set/mod007-card-mod-format/all/error.rb

Instance Method Summary collapse

Instance Method Details

#error_messagesObject



39
40
41
42
43
44
45
46
47
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 39

def error_messages
  card.errors.map do |error|
    if error.attribute == :abort
      simple_error_message error.message
    else
      standard_error_message error
    end
  end
end

#simple_error_message(message) ⇒ Object

for override



50
51
52
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 50

def simple_error_message message
  message
end

#standard_error_message(error) ⇒ Object

for override



55
56
57
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 55

def standard_error_message error
  "#{error.attribute.to_s.upcase}: #{error.message}"
end

#unsupported_view_error_message(view) ⇒ Object



59
60
61
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 59

def unsupported_view_error_message view
  tr(:unsupported_view, view: view, cardname: card.name)
end

#view: bad_addressObject



30
31
32
33
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 30

view :bad_address, perms: :none do
  root.error_status = 404
  tr(:bad_address)
end

#view: compact_missingObject



9
10
11
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 9

view :compact_missing, perms: :none, compact: true do
  ""
end

#view: denialObject



21
22
23
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 21

view :denial, perms: :none do
  focal? ? tr(:denial) : ""
end

#view: errorsObject



35
36
37
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 35

view :errors do
  ["Problem:", "", error_messages].flatten.join "\n"
end

#view: not_foundObject



25
26
27
28
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 25

view :not_found, perms: :none do
  error_name = card.name.present? ? safe_name : tr(:not_found_no_name)
  tr(:not_found_named, cardname: error_name)
end

#view: server_errorObject



17
18
19
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 17

view :server_error, perms: :none do
  tr(:server_error)
end

#view: unknownObject



13
14
15
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 13

view :unknown, perms: :none, cache: :never do
  ""
end