lib/locomotive/builder/exceptions.rb in locomotivecms_builder-1.0.0.alpha2 vs lib/locomotive/builder/exceptions.rb in locomotivecms_builder-1.0.0.alpha3

- old
+ new

@@ -1,12 +1,22 @@ module Locomotive module Builder class DefaultException < ::Exception - def initialize(message = nil) - # no specific treatment for now - super + def initialize(message = nil, parent_exception = nil) + self.log_backtrace(parent_exception) if parent_exception + + super(message) + end + + protected + + def log_backtrace(parent_exception) + full_error_message = "#{parent_exception.message}\n\t" + full_error_message += parent_exception.backtrace.join("\n\t") + full_error_message += "\n\n" + Locomotive::Builder::Logger.fatal full_error_message end end class MounterException < DefaultException