Exception: PgVerify::Core::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pg-verify/core/core.rb

Instance Method Summary collapse

Instance Method Details

#formattedObject



7
8
9
# File 'lib/pg-verify/core/core.rb', line 7

def formatted()
    raise "Not implemented in subclass #{self.class}"
end

#to_formattedObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pg-verify/core/core.rb', line 11

def to_formatted()
    title, body, hint = self.formatted()

    message = []
    
    error_label = " ✖ ERROR ".bg_error
    message << "#{error_label} #{title.c_error}" unless title.nil?

    indent = "  ".bg_error + "  "
    message << "#{indent}\n#{body.indented(str: indent)}\n#{indent}" unless body.nil?

    indent = "  ".bg_warn + "  "
    message << backtrace.map.map {|l| "#{indent}#{l.c_warn}"}.join("\n") if Settings.full_stack_trace

    indent = "  ".bg_sidenote + "  "
    message << hint.split("\n").map {|l| "#{indent}#{l.c_sidenote}"}.join("\n") unless hint.nil?

    return message.join("\n")
end