Sha256: b7187654eb8bcfa9f126e17049502a25f9db692625f64d2095cda5e4faaffb98

Contents?: true

Size: 785 Bytes

Versions: 13

Compression:

Stored size: 785 Bytes

Contents

module JsonapiCompliable
  module Errors
    class BadFilter < 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

13 entries across 13 versions & 1 rubygems

Version Path
jsonapi_compliable-0.6.2 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.6.1 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.6.0 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.7 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.6 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.5 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.4 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.3 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.2 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.5.1 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.4.0 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.3.10 lib/jsonapi_compliable/errors.rb
jsonapi_compliable-0.3.9 lib/jsonapi_compliable/errors.rb