diff --git a/lib/Dhalang/configuration.rb b/lib/Dhalang/configuration.rb index 7d25627..0630e6d 100644 --- a/lib/Dhalang/configuration.rb +++ b/lib/Dhalang/configuration.rb @@ -55,9 +55,9 @@ class Configuration private attr_accessor :screenshot_options private attr_accessor :jpeg_options - # @param [Hash] custom_options Changes that should override default. + # @param [Hash] custom_options Changes that override default. # @param [String] page_url Url for Puppeteer to visit. - # @param [String] temp_file_path Absolute path of temp file to write results of scripts towards. + # @param [String] temp_file_path Absolute path of temp file to use for writing script results. # Can be nil for scripts using stdout. # @param [String] temp_file_extension Extension of temp file. Can be nil for scripts using stdout. def initialize(custom_options, page_url, temp_file_path = nil, temp_file_extension = nil) diff --git a/lib/Dhalang/node_script_invoker.rb b/lib/Dhalang/node_script_invoker.rb index b649164..19b11e3 100644 --- a/lib/Dhalang/node_script_invoker.rb +++ b/lib/Dhalang/node_script_invoker.rb @@ -3,8 +3,8 @@ class NodeScriptInvoker # Executes JS script under given script_path by launching a new Node process. # - # @param [String] script_path Absolute path of the JS script to execute. - # @param [Configuration] configuration Configuration to use by j. + # @param [String] script_path Absolute path of JS script to execute. + # @param [Configuration] configuration Configuration to use. def self.execute_script(script_path, configuration) command = create_node_command(script_path, configuration) Open3.popen2e(command) do |_stdin, stdouterr, wait| @@ -17,10 +17,10 @@ def self.execute_script(script_path, configuration) end end - # Returns a [String] with the node command to invoke the provided script with the configuration. + # Returns a [String] with node command that invokes the provided script with the configuration. # # @param [String] script_path Absolute path of JS script to invoke. - # @param [Object] configuration JSON with options to use for Puppeteer. + # @param [Configuration] configuration Configuration to use. private_class_method def self.create_node_command(script_path, configuration) "node #{script_path} #{Shellwords.escape(configuration.json)}" end diff --git a/lib/js/screenshot-generator.js b/lib/js/screenshot-generator.js index 7062b4a..3ed6aa1 100644 --- a/lib/js/screenshot-generator.js +++ b/lib/js/screenshot-generator.js @@ -20,6 +20,7 @@ const createScreenshot = async () => { ...configuration.screenshotOptions }); } catch (error) { + console.error(error.message); process.exit(1); } finally { if (browser) {