Sha256: 1fc0cbc8b5b407e05a62a8fceb38cae22f6227d2c91795a2cc9f72b955d36d91

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pione-0.3.2 lib/pione/location/location-exception.rb
pione-0.3.1 lib/pione/location/location-exception.rb
pione-0.3.0 lib/pione/location/location-exception.rb