Sha256: cab1c4a54b500299e1f6239b5e08f6152d1570ffa7f5abb135f5562528847e27

Contents?: true

Size: 892 Bytes

Versions: 3

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

class Grover
  #
  # Error classes for calling out to Puppeteer NodeJS library
  #
  # Heavily based on the Schmooze library https://github.com/Shopify/schmooze
  #
  Error = Class.new(StandardError)
  DependencyError = Class.new(Error)
  module JavaScript # rubocop:disable Style/Documentation
    Error = Class.new(::Grover::Error)
    UnknownError = Class.new(Error)

    ErrorWithDetails = Class.new(Error) do
      def initialize(name, error_details)
        super(name)
        @error_details = Grover::Utils.deep_transform_keys_in_object error_details, &:to_sym
      end

      attr_reader :error_details
    end
    RequestFailedError = Class.new(ErrorWithDetails)
    PageRenderError = Class.new(ErrorWithDetails)

    def self.const_missing(name)
      const_set name, Class.new(Error)
    end
  end
  UnsafeConfigurationError = Class.new(Error)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grover-1.2.1 lib/grover/errors.rb
grover-1.2.0 lib/grover/errors.rb
grover-1.1.11 lib/grover/errors.rb