Sha256: 6bd05c051740f35c915838c13c84733bd3ee71ac7048e3fdc0e9247f084f3cc5

Contents?: true

Size: 864 Bytes

Versions: 14

Compression:

Stored size: 864 Bytes

Contents

module ActsAsCloudhdr
  
  class Error < StandardError

    def initialize(error_or_message)
      if error_or_message.is_a?(Exception)
        @error = error_or_message
      else
        @message = error_or_message
      end
    end

    def message
      @message || "#{@error.class} (wrapped in a #{self.class}) - #{@error.message}"
    end

    def backtrace
      if @error
        @error.backtrace
      else
        super
      end
    end

    def inspect
      if @error
        "#{@error.inspect} (wrapped in a #{self.class})"
      else
        super
      end
    end

    def to_s
      if @error
        "#{@error.class} (wrapped in a #{self.class}) - #{@error}"
      else
        super
      end
    end
  end

  class HTTPError < Error; end
  class ThumbnailNotFoundError < Error; end
  class ThumbnailAttributesNotFoundError < Error; end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cloudhdr_rails-0.0.14 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.13 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.12 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.11 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.10 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.9 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.8 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.7 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.6 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.5 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.4 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.3 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.2 lib/cloudhdr_rails/errors.rb
cloudhdr_rails-0.0.1 lib/cloudhdr_rails/errors.rb