Module: Knj::Errors
- Defined in:
- lib/knj/errors.rb
Overview
This module contains various extra errors used by the other Knj-code.
Defined Under Namespace
Class Method Summary collapse
-
.error_str(err, args = {}) ⇒ Object
Returns a string describing the given error.
Class Method Details
.error_str(err, args = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/knj/errors.rb', line 17 def self.error_str(err, args = {}) if !err.is_a?(Exception) and err.class. != "Java::JavaLang::LinkageError" raise "Invalid object of class '#{err.class.name}' given." end str = "" if args[:html] str << "<b>#{Knj::Web.html(err.class.name)}</b>: #{Knj::Web.html(err.)}<br />\n<br />\n" err.backtrace.each do |bt| str << "#{Knj::Web.html(bt)}<br />\n" end str << "<br />\n<br />\n" else str << "#{err.class.name}: #{err.}\n\n" str << err.backtrace.join("\n") str << "\n\n" end return str end |