Sha256: 320e14bd22b21bd1a6171bb869cc3e8e6906a5c1ca623637761f5c18dc0c3e64

Contents?: true

Size: 742 Bytes

Versions: 2

Compression:

Stored size: 742 Bytes

Contents

module HawatelPS
  class HawatelPSException < Exception
    # Custom exception
    # @param args [Hash] the options to create a custom exception message
    # @option :exception [Exception] Native Exception object
    # @option :message [String] Custom message
    # @return [void]
    def initialize(args = {:exception => nil, :message => nil})
      super(exception_enrichment(args))
    end

    private
    def exception_enrichment(args)
      error_message = ''
      error_message += args[:message] unless args[:message].nil?
      error_message +=
          "\nNative exception from '#{args[:exception].class}':\n#{args[:exception].message}" unless args[:exception].nil?
      return error_message
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hawatel_ps-0.1.2 lib/hawatel_ps/shared/hawatelps_exception.rb
hawatel_ps-0.1.1 lib/hawatel_ps/shared/hawatelps_exception.rb