Sha256: abadfad56d9eeb67ba71569ffcb209a663ecd9637f3abbda330a4361a9fd379e

Contents?: true

Size: 1.68 KB

Versions: 18

Compression:

Stored size: 1.68 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
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
chupa-text-1.2.6 lib/chupa-text/error.rb
chupa-text-1.2.5 lib/chupa-text/error.rb
chupa-text-1.2.4 lib/chupa-text/error.rb
chupa-text-1.2.3 lib/chupa-text/error.rb
chupa-text-1.2.2 lib/chupa-text/error.rb
chupa-text-1.2.1 lib/chupa-text/error.rb
chupa-text-1.2.0 lib/chupa-text/error.rb
chupa-text-1.1.9 lib/chupa-text/error.rb
chupa-text-1.1.8 lib/chupa-text/error.rb
chupa-text-1.1.7 lib/chupa-text/error.rb
chupa-text-1.1.6 lib/chupa-text/error.rb
chupa-text-1.1.5 lib/chupa-text/error.rb
chupa-text-1.1.4 lib/chupa-text/error.rb
chupa-text-1.1.3 lib/chupa-text/error.rb
chupa-text-1.1.2 lib/chupa-text/error.rb
chupa-text-1.1.1 lib/chupa-text/error.rb
chupa-text-1.1.0 lib/chupa-text/error.rb
chupa-text-1.0.9 lib/chupa-text/error.rb