mikaa123/umlify

download_image has no error handling

Opened this issue · 1 comments

The download_image function should check if the response from yUML is a valid image. If it returns for instance a 500 Internal Server Error, the error message is saved as HTML into the .PNG file.

Same applies for establishing the connection. If trying to connect where a proxy connection is required, it fails with this pretty ugly error message:

C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': A connection attempt
failed because the connected party did not properly respond after a period of ti
me, or established connection failed because connected host has failed to respon
d. - connect(2) (Errno::ETIMEDOUT)
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/umlify-1.2.6/lib/umlify/runner.
rb:64:in `download_image'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/umlify-1.2.6/lib/umlify/runner.
rb:43:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/umlify-1.2.6/lib/umlify.rb:47:i
n `execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/umlify-1.2.6/bin/umlify:5:in `<
top (required)>'
        from C:/Ruby193/bin/umlify:19:in `load'
        from C:/Ruby193/bin/umlify:19:in `<main>'