Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command should fail if there is an error #3

Open
tmaier opened this issue Mar 26, 2021 · 9 comments
Open

Command should fail if there is an error #3

tmaier opened this issue Mar 26, 2021 · 9 comments
Milestone

Comments

@tmaier
Copy link

tmaier commented Mar 26, 2021

First off: This gem is really cool! Thanks for building it

I had a syntax error in my application.
But Rackula just continues to crawl the site.

  0.0s     info: Rackula::Command::Generate [oid=0x3fe6f90682e8] [pid=890] [2021-03-26 07:52:03 +0000]
               | Setting up container to serve site on port 36855...
 2.75s    error: Async::Task [oid=0x3fe6f9070f60] [pid=891] [2021-03-26 07:52:06 +0000]
               |   NoMethodError: undefined method `options' for Brand::LogoComponent:Class
               |   Did you mean?  option

It would be cool if rackula would stop and exit with an error in such a case.

One way would be to add an option to fail on HTTP 500 responses, of even better: to identify such an exception as above.

@ioquatix
Copy link
Member

Yes we should totally do this.

@ioquatix
Copy link
Member

I think failing on 5xx errors is probably reasonable - the error is thrown server side, it will result in a 5xx - what does wget do in this case?

@tmaier
Copy link
Author

tmaier commented Aug 7, 2021

According to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html, wget would exit with the status code 8.
I tested it with https://httpstat.us/503

$ wget https://httpstat.us/503
--2021-08-07 23:33:37--  https://httpstat.us/503
Auflösen des Hostnamens httpstat.us (httpstat.us)… 2606:4700:3031::6815:19bb, 2606:4700:3032::ac43:8679, 172.67.134.121, ...
Verbindungsaufbau zu httpstat.us (httpstat.us)|2606:4700:3031::6815:19bb|:443 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 503 Service Unavailable
2021-08-07 23:33:38 FEHLER 503: Service Unavailable.

$ echo $?
8

@tmaier
Copy link
Author

tmaier commented Dec 10, 2021

Hi @ioquatix,

how are you doing? I know I answered late, but is there any ways you could add this?

@ioquatix ioquatix added this to the v1.2.0 milestone Dec 10, 2021
@ioquatix
Copy link
Member

Can you let me know if this is working for you?

@tmaier
Copy link
Author

tmaier commented Dec 18, 2021

It works, but it lacks information to debug.
It should raise the URL, which did not work as well.

3-0
Converting links in /builds/Librario/librario-ui/static/rails/view_components/publication/attributes/number_component/default.html... 2.
2-0
Converting links in /builds/Librario/librario-ui/static/rails/view_components/publication/attributes/volume_component/default.html... 2.
2-0
Converting links in /builds/Librario/librario-ui/static/rails/view_components/page_component.html... 4.
4-0
Converting links in /builds/Librario/librario-ui/static/packs/css/application-4044f0b5.css... 18.
18-0
Converted links in 97 files in 0.03 seconds.
{"time":"2021-12-11T09:23:06+00:00","severity":"warn","class":"Async::Container::Process","oid":3460,"pid":144,"subject":"#<Async::Container::Process Unnamed>","message":"Process 146 is blocking, has it exited?"}
{"time":"2021-12-11T09:23:06+00:00","severity":"info","class":"Async::Container::Forked","oid":3580,"pid":144,"subject":"Async::Container::Forked with 4 spawns and 0 failures.","message":"#<Async::Container::Process Unnamed> exited with pid 146 exit 0"}
{"time":"2021-12-11T09:23:07+00:00","severity":"info","class":"Async::Container::Forked","oid":3580,"pid":144,"subject":"Async::Container::Forked with 4 spawns and 0 failures.","message":"#<Async::Container::Process Unnamed> exited with pid 145 exit 0"}
{"time":"2021-12-11T09:23:07+00:00","severity":"info","class":"Async::Container::Forked","oid":3580,"pid":144,"subject":"Async::Container::Forked with 4 spawns and 0 failures.","message":"#<Async::Container::Process Unnamed> exited with pid 147 exit 0"}
{"time":"2021-12-11T09:23:07+00:00","severity":"info","class":"Async::Container::Forked","oid":3580,"pid":144,"subject":"Async::Container::Forked with 4 spawns and 0 failures.","message":"#<Async::Container::Process Unnamed> exited with pid 148 exit 0"}
bundler: failed to load command: rackula (/builds/Librario/librario-ui/vendor/ruby/2.7.0/bin/rackula)
/builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/lib/rackula/command/generate.rb:73:in `copy_and_fetch': The wget command failed! (RuntimeError)
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/lib/rackula/command/generate.rb:106:in `run'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/lib/rackula/command/generate.rb:119:in `call'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/lib/rackula/command.rb:56:in `call'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/samovar-2.1.4/lib/samovar/command.rb:36:in `call'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/lib/rackula/command.rb:28:in `call'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/gems/rackula-1.2.0/bin/rackula:25:in `<top (required)>'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/bin/rackula:23:in `load'
	from /builds/Librario/librario-ui/vendor/ruby/2.7.0/bin/rackula:23:in `<top (required)>'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `load'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `kernel_load'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:28:in `run'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli.rb:475:in `exec'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/cli.rb:25:in `start'
	from /usr/local/bundle/gems/bundler-2.2.24/exe/bundle:49:in `block in <top (required)>'
	from /usr/local/bundle/gems/bundler-2.2.24/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
	from /usr/local/bundle/gems/bundler-2.2.24/exe/bundle:37:in `<top (required)>'
	from /usr/local/bundle/bin/bundle:23:in `load'
	from /usr/local/bundle/bin/bundle:23:in `<main>'

@ioquatix
Copy link
Member

Okay, let me see if I can make this better, I ran into similar issues when using the new version in practice.

@tmaier
Copy link
Author

tmaier commented Dec 18, 2021

as I am currently playing around with it, I see the following error:

Traceback (most recent call last):
        8: from /usr/local/bundle/bin/rackula:23:in `<main>'
        7: from /usr/local/bundle/bin/rackula:23:in `load'
        6: from /usr/local/bundle/gems/rackula-1.2.0/bin/rackula:25:in `<top (required)>'
        5: from /usr/local/bundle/gems/rackula-1.2.0/lib/rackula/command.rb:28:in `call'
        4: from /usr/local/bundle/gems/samovar-2.1.4/lib/samovar/command.rb:36:in `call'
        3: from /usr/local/bundle/gems/rackula-1.2.0/lib/rackula/command.rb:56:in `call'
        2: from /usr/local/bundle/gems/rackula-1.2.0/lib/rackula/command/generate.rb:119:in `call'
        1: from /usr/local/bundle/gems/rackula-1.2.0/lib/rackula/command/generate.rb:106:in `run'
/usr/local/bundle/gems/rackula-1.2.0/lib/rackula/command/generate.rb:58:in `copy_and_fetch': uninitialized constant Samovar::Failure (NameError)

I am not sure, if this is related.

I am a bit surprise from this error.

It is defined here, but as far as I can see it it never required
https://github.com/ioquatix/samovar/blob/master/lib/samovar/failure.rb

@tmaier
Copy link
Author

tmaier commented Dec 18, 2021

And there is another issue, I ran into, which shows that I did not think too far...

Yes I am interested, that the rackula fails, if certain pages can't be downloaded.
There are certain URLs, which I want it to fail.

Note: I am using Rackula, to create a static version of some screens of my app. All URLs of the index.html must be downloaded. All sub-links are not that relevant. (see https://librario-ui.web.app)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants