Sha256: c53f9813730718be056da51d0993f50ae2917d83a53995109f53fc446c2ce620

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

class Zencoder
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zencoder-2.2.2 lib/zencoder/errors.rb
zencoder-2.2.1 lib/zencoder/errors.rb
zencoder-2.2.0 lib/zencoder/errors.rb
zencoder-2.1.15 lib/zencoder/errors.rb
zencoder-2.1.14 lib/zencoder/errors.rb