Sha256: ddb9ea6e7313ac0028a465b64fa7aae7c7a139ba834af790699410cbaab13e48

Contents?: true

Size: 1.87 KB

Versions: 4

Compression:

Stored size: 1.87 KB

Contents

# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


require "gcloud/errors"

module Gcloud
  module Datastore
    ##
    # # Datastore Error
    #
    # Base Datastore exception class.
    class Error < Gcloud::Error
    end

    ##
    # # KeyfileError
    #
    # Raised when a keyfile is not correct.
    class KeyfileError < Gcloud::Datastore::Error
    end

    ##
    # # ApiError
    #
    # Raised when an API call is not successful.
    class ApiError < Gcloud::Datastore::Error
      ##
      # The API method of the failed HTTP request.
      attr_reader :method

      ##
      # The response object of the failed HTTP request.
      attr_reader :response

      # @private
      def initialize method, response = nil
        super("API call to #{method} was not successful")
        @method = method
        @response = response
      end
    end

    ##
    # # PropertyError
    #
    # Raised when a property is not correct.
    class PropertyError < Gcloud::Datastore::Error
    end

    ##
    # # TransactionError
    #
    # General error for Transaction problems.
    class TransactionError < Gcloud::Datastore::Error
      ##
      # An error that occurred within the transaction. (optional)
      attr_reader :inner

      # @private
      def initialize message, inner = nil
        super(message)
        @inner = inner
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gcloud-0.8.0 lib/gcloud/datastore/errors.rb
gcloud-0.7.2 lib/gcloud/datastore/errors.rb
gcloud-0.7.1 lib/gcloud/datastore/errors.rb
gcloud-0.7.0 lib/gcloud/datastore/errors.rb