shairontoledo / rghost

RGhost is a document creation and conversion API. It uses the Ghostscript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents. Support(PDF,PS,GIF,TIF,PNG,JPG,etc)
http://rghost.rubyforge.org
MIT License
187 stars 46 forks source link

render_stream method ignoring render errors #38

Closed josecoelho closed 11 years ago

josecoelho commented 11 years ago

Hi, I'm with a problem on my production enviroment.

I receive the error without any explanation: NoMethodError (private method readlines' called for nil:NilClass): app/admin/invoice_items.rb:63:ingen_boleto'

Looking on the code of RGhost, I found a problem on method render_stream. That ignores the possible errors ocurred on render method, and call rg.output when thats nil. It results in a nightmare error... :)

As a quick fix, I raised the errors if RGhost has errors.

shairontoledo commented 11 years ago

I've improved that by adding to the render method ability to throw out RGhost::RenderException in case of any error. I also created a flag RGhost::Config::GS[:raise_on_error] to keep backward compatibility, default is true.

Changes on https://github.com/shairontoledo/rghost/commit/e2cdcd9e8c72d178625a69f0bef167e03a833fb9

New gem 0.9.1 has been created.

Thanks,