Sha256: ddb169a03f3e0e1195e10010a2d2b5f7caa8f995d2476254da4a2a6e67cfd44a

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

module Locomotive
  module Builder

    class DefaultException < ::Exception

      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
    end

    class GeneratorException < DefaultException

      def log_backtrace(parent_exception)
        # Logger not initialized at this step
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms_builder-1.0.0.alpha8 lib/locomotive/builder/exceptions.rb
locomotivecms_builder-1.0.0.alpha7 lib/locomotive/builder/exceptions.rb