njosefbeck / gatsby-source-stripe

Gatsby source plugin for building websites using Stripe as a data source
74 stars 17 forks source link

Format download files errors better #27

Closed njosefbeck closed 5 years ago

njosefbeck commented 5 years ago
Screen Shot 2019-04-13 at 7 51 30 AM

So I know that the download files feature doesn't work with images uploaded to Stripe, so the errors I got make sense, BUT all the errors were a bit overwhelming. The URL in the "Failed to process remote content" seems to show up twice, and the formatting could be improved.

Ignore the non-capitalization of "stripe" in the screenshot. I fixed that and it's in the latest release.

Let me know your thoughts on how we might improve these error outputs @brxck and @Francesco-Lanciana !

Thanks!

njosefbeck commented 5 years ago

Also, another thought: if we want to use that X in front of our error messages, maybe we can pull that out into some kind of error function, so all our errors can be formatted in the same way. Just a thought!

Francesco-Lanciana commented 5 years ago

I agree, it is a bit much. Right now we could more or less remove the error messages I placed in since they aren't really telling you anything that gatsby-source-filesystem isn't already logging. I'm really not a fan of that plugin's use of console.warn though, it should give you more control of what is logged. Ideally I would really like the following format:

Id Type Num Images Time Taken Passed Failed
1 Product 4 5.2sec 3 1
2 Sku 1 5.2sec 0 1

Failed URLs: 1 - https://files.stripe.com/files/.... (E1) 2 - https://files.stripe.com/files/.... (E2)

Errors: E1) We were unable to create a valid Gatsby node E2) Some other error happened

The errors is seperate because although right now there is only one error message in the future there may be more, and it would be annoying to see the same error over and over

I have two ways we could do this. 1) Make a PR to gatsby-source-filesystem that gives more fine grained control over what is reported to the console 2) This may be a very bad idea but overwrite console.warn/log just before we call create createRemoteFileNode with a function that aggregates the errors, then after all the nodes are all created/failed log the messages in the format mentioned above.

I agree with the error function thought :)

brxck commented 5 years ago

Related and possibly helpful: gatsby-cli's output is being changed to solve some of the jumbled error message issues.

Jossdz commented 5 years ago

Does anyone have solved this ? 😢

njosefbeck commented 5 years ago

Not yet! Are you experiencing an issue @Jossdz ?

Jossdz commented 5 years ago

Yes, i'm having the same issue @njosefbeck

Captura de pantalla 2019-04-23 a la(s) 18 04 08
njosefbeck commented 5 years ago

@Jossdz 1) Are you hosting these images within Stripe? If so, you unfortunately won't be able to use the downloadFiles feature due to how Stripe formats the URL.

2) This issue is related to the amount of errors that are logged to the console, but it seems like the feature is working as expected in your case.

If by chance you're not hosting the images that you're trying to download on Stripe, let us know, and provide some example URLs, if possible.

njosefbeck commented 5 years ago

@Jossdz You shouldn't run into issues now with downloading Product and Sku images. I'm going to close this for now, but feel free to re-open if you experience any problems.