Sha256: b5bb11b8bdff06e68290e9a1a0653f1aa5d2e7dde831086fb5f4f69ae283e3a4

Contents?: true

Size: 832 Bytes

Versions: 31

Compression:

Stored size: 832 Bytes

Contents

module JsonapiCompliable
  module Errors
    class BadFilter < StandardError; end
    class ValidationError < StandardError; end

    class UnsupportedPageSize < StandardError
      def initialize(size, max)
        @size, @max = size, max
      end

      def message
        "Requested page size #{@size} is greater than max supported size #{@max}"
      end
    end

    class StatNotFound < StandardError
      def initialize(attribute, calculation)
        @attribute = attribute
        @calculation = calculation
      end

      def message
        "No stat configured for calculation #{pretty(@calculation)} on attribute #{pretty(@attribute)}"
      end

      private

      def pretty(input)
        if input.is_a?(Symbol)
          ":#{input}"
        else
          "'#{input}'"
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
jsonapi_compliable-0.10.7 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.6 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.5 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.4 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.3 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.2 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.1 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.10.0 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.9.2 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.9.1 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.9.0 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.8.0 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.9 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.8 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.7 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.6 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.5 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.4 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.3 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.7.2 lib/jsonapi_compliable/errors.rb