Sha256: f86c88e1a170d45b7e908c0a3f490edf61eb99ea5e32439186b0d515826610ad

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

module Pione
  module Location
    # LocationError is raised when any resource errors happen.
    class LocationError < StandardError
      def initialize(location, option={})
        @location = location
        @option = option
      end
    end

    # ExistAlready is raised when there is data on the location already.
    class ExistAlready < LocationError
      def message
        "the location exists already: %s" % @location.inspect
      end
    end

    # NotFound is raised when there isn't data on the location.
    class NotFound < LocationError
      def message
        "location \"%s\" not found" % @location.address
      end
    end

    # InvalidFileOperation represents you do file operation to directory.
    class InvalidFileOperation < LocationError
      def message
        "invalid file operation: %s" % @location.inspect
      end
    end

    # GitError is raised when git command operation fails.
    class GitError < LocationError
      def message
        "%s: %s" % [@option[:message], @location.address]
      end
    end

    # NotLocal is raised when local location is expected but it is other type location.
    class NotLocal < LocationError
      def initialize(location)
        @location = location
      end

      def message
        "the location \"%s\" should local location" % @location.address
      end
    end

    # `DropboxLocationUnavailable` is raised when Dropbox location isn't
    # unavailable.
    class DropboxLocationUnavailable < LocationError
      def initialize(message)
        @message = message
      end

      def message
        @message
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pione-0.5.0 lib/pione/location/location-exception.rb
pione-0.5.0.alpha.2 lib/pione/location/location-exception.rb
pione-0.5.0.alpha.1 lib/pione/location/location-exception.rb
pione-0.4.2 lib/pione/location/location-exception.rb
pione-0.4.1 lib/pione/location/location-exception.rb
pione-0.4.0 lib/pione/location/location-exception.rb