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

Feature: Add flag to fail to generate PDF if assets fail to load. #112

Merged
merged 10 commits into from
Jun 2, 2021

Conversation

deanmarano
Copy link
Contributor

Hi there! Grover has made our lives so much easier, thank you!

I'm hoping to add in a feature to allow PDF generation to fail when an asset fails to load. I've added a test and a line to the README. Any feedback or help getting this in would be greatly appreciated.

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @deanmarano the idea is solid and the change is looking great. I've left a few comments but nothing too drastic. Take a look and let me know what you think. 👍

lib/grover/js/processor.js Outdated Show resolved Hide resolved
lib/grover/js/processor.js Outdated Show resolved Hide resolved
lib/grover/js/processor.js Outdated Show resolved Hide resolved
} else if (e.response() && e.response().status()) {
return e.response.status() + " " + e.url();
} else {
return "ERR" + " " + e.url()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things here.

  1. "ERR" seems maybe a tad vague. It seems like timeouts etc would be handled by the e.failure() case and bad responses by the e.response().status() case. What do you see this handling? If it's "unknown" then suggest using language to that point.
  2. "ERR " + e.url() would seem simpler (albeit after addressing point 1.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this in before the code was properly handling the previous cases. I think the way the code is structured, I would prefer to keep a else condition (so we don't have things in the errors array that don't have error messages) so I'll change this to state it's an unknown error.

lib/grover/js/processor.js Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
deanmarano and others added 2 commits May 28, 2021 09:15
Co-authored-by: Andrew Bromwich <a.bromwich@gmail.com>
@deanmarano deanmarano requested a review from abrom May 28, 2021 14:58
Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting really close @deanmarano

I've noticed a few bugs as well as a couple of missing specs (ie test the success result when the option is enabled, but no errors.. and test for a 404).

I've also left a comment about the option name itself. I think as it currently stands it's a bit vague about what it'll do when enabled. A slightly more verbose option name should get rid of any of that ambiguity.

lib/grover/js/processor.js Outdated Show resolved Hide resolved
lib/grover/js/processor.js Outdated Show resolved Hide resolved
spec/grover/processor_spec.rb Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@deanmarano deanmarano requested a review from abrom June 1, 2021 18:21
Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @deanmarano it looks like there's still one test case missing (404). Can you please add that in? Suggest something like https://google.com/invalid.png or similar

spec/grover/processor_spec.rb Outdated Show resolved Hide resolved
@deanmarano
Copy link
Contributor Author

@abrom It looks like an expired w3.org cert is causing some tests to fail. I would guess they'll fix it relatively quickly?

@deanmarano deanmarano requested a review from abrom June 2, 2021 04:40
Copy link
Contributor

@abrom abrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @deanmarano 👍

Thanks for the contribution!

@abrom abrom merged commit a1f0c2a into Studiosity:main Jun 2, 2021
@abrom
Copy link
Contributor

abrom commented Jun 2, 2021

FYI this has been released in v1.0.1

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

Successfully merging this pull request may close these issues.

None yet

2 participants