Sha256: a1cd98c85a461e0a3161e7a51f133cad9980919d83d7d03ab1340a16dfee1474

Contents?: true

Size: 1.07 KB

Versions: 27

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

# rubocop:disable: Layout/IndentHeredoc
module ReactOnRails
  class PrerenderError < RuntimeError
    # err might be nil if JS caught the error
    def initialize(component_name: nil, err: nil, props: nil,
                   js_code: nil, console_messages: nil)
      message = "ERROR in SERVER PRERENDERING\n".dup
      if err
        # rubocop:disable Layout/IndentHeredoc
        message << <<-MSG
Encountered error: \"#{err}\"
        MSG
        # rubocop:enable Layout/IndentHeredoc
        backtrace = err.backtrace.join("\n")
      else
        backtrace = nil
      end
      # rubocop:disable Layout/IndentHeredoc
      message << <<-MSG
when prerendering #{component_name} with props: #{props}
js_code was:
#{js_code}
      MSG
      # rubocop:enable Layout/IndentHeredoc

      if console_messages
        # rubocop:disable Layout/IndentHeredoc
        message << <<-MSG
console messages:
#{console_messages}
        MSG
        # rubocop:enable Layout/IndentHeredoc
      end

      super([message, backtrace].compact.join("\n"))
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
react_on_rails-10.1.4 lib/react_on_rails/prerender_error.rb
react_on_rails-10.1.3 lib/react_on_rails/prerender_error.rb
react_on_rails-10.1.1 lib/react_on_rails/prerender_error.rb
react_on_rails-10.1.0 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.3 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.2 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.1 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.rc.0 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.12 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.11 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.10 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.9 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.8 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.7 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.6 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.5 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.4 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.3 lib/react_on_rails/prerender_error.rb
react_on_rails-9.0.0.beta.2 lib/react_on_rails/prerender_error.rb