Sha256: 27c217fb30367d010a42333973f20d7fb2c94d6cbed29916208d5f3e7ec1ee2b

Contents?: true

Size: 866 Bytes

Versions: 26

Compression:

Stored size: 866 Bytes

Contents

module ActsAsPhocodable
  
   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

26 entries across 26 versions & 1 rubygems

Version Path
phocoder-rails-0.0.58 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.57 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.56 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.55 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.54 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.53 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.52 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.51 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.50 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.49 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.48 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.47 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.46 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.45 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.44 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.43 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.42 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.41 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.40 lib/phocoder_rails/errors.rb
phocoder-rails-0.0.39 lib/phocoder_rails/errors.rb