Skip to content

Commit

Permalink
Raise exception on all pdf generation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasbarton committed Jul 9, 2018
1 parent f06f00e commit 6787112
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ class ThingsController < ApplicationController
no_background: true,
viewport_size: 'TEXT', # available only with use_xserver or patched QT
extra: '', # directly inserted into the command to wkhtmltopdf
raise_on_all_errors: nil, # raise error for any stderr output. Such as missing media, image assets
outline: { outline: true,
outline_depth: LEVEL },
margin: { top: SIZE, # default 10 (mm)
Expand Down
1 change: 1 addition & 0 deletions lib/wicked_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def pdf_from_url(url, options = {})
generated_pdf_file.rewind
generated_pdf_file.binmode
pdf = generated_pdf_file.read
raise "Error generating PDF\n Command Error: #{err}" if options[:raise_on_all_errors] && !err.empty?
raise "PDF could not be generated!\n Command Error: #{err}" if pdf && pdf.rstrip.empty?
pdf
rescue StandardError => e
Expand Down

0 comments on commit 6787112

Please sign in to comment.