Sha256: 053054fde19eaccf5265cbe0f601c81b7d358f7a09a370cd2fec8746df5a69ca

Contents?: true

Size: 1.9 KB

Versions: 10

Compression:

Stored size: 1.9 KB

Contents

# Copyright (C) 2013-2014  Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

module ChupaText
  class Error < StandardError
  end

  class DownloadError < Error
    attr_reader :uri
    attr_reader :reason
    def initialize(uri, reason)
      @uri = uri
      @reason = reason
      super("Download error: <#{uri}>: #{reason}")
    end
  end

  class EncryptedError < Error
    attr_reader :data
    def initialize(data)
      @data = data
      super("Encrypted data: <#{data.uri}>(#{data.mime_type})")
    end
  end

  class InvalidDataError < Error
    attr_reader :data, :detail
    def initialize(data, detail)
      @data = data
      @detail = detail
      super("Invalid data: <#{data.uri}>(#{data.mime_type}): <#{detail}>")
    end
  end

  class UnknownEncodingError < Error
    attr_reader :data, :encoding
    def initialize(data, encoding)
      @data = data
      @encoding = encoding
      super("Unknown encoding data: <#{data.uri}>(#{data.mime_type}): <#{encoding}>")
    end
  end

  class TimeoutError < Error
    attr_reader :data, :timeout
    def initialize(data, timeout)
      @data = data
      @timeout = timeout
      super("Timeout error: <#{data.uri}>(#{data.mime_type}): <#{timeout}>")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chupa-text-1.3.6 lib/chupa-text/error.rb
chupa-text-1.3.5 lib/chupa-text/error.rb
chupa-text-1.3.4 lib/chupa-text/error.rb
chupa-text-1.3.3 lib/chupa-text/error.rb
chupa-text-1.3.2 lib/chupa-text/error.rb
chupa-text-1.3.1 lib/chupa-text/error.rb
chupa-text-1.3.0 lib/chupa-text/error.rb
chupa-text-1.2.9 lib/chupa-text/error.rb
chupa-text-1.2.8 lib/chupa-text/error.rb
chupa-text-1.2.7 lib/chupa-text/error.rb