Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: throw and catch error when calls to cloudinary upload fails #72

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

matiasfha
Copy link
Contributor

@matiasfha matiasfha commented Sep 15, 2023

Description

Catch errors when using cloudinary uploader. Throw in the lib catch during build and log them .

Issue Ticket Number

Fixed #58

CleanShot 2023-09-21 at 11 40 00

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have followed the contributing guidelines of this project as mentioned in CONTRIBUTING.md
  • I have created an issue ticket for this PR
  • I have checked to ensure there aren't other open Pull Requests for the same update/change?
  • I have performed a self-review of my own code
  • I have run tests locally to ensure they all pass
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes needed to the documentation

@netlify
Copy link

netlify bot commented Sep 15, 2023

Deploy Preview for netlify-plugin-cloudinary ready!

Name Link
🔨 Latest commit 656654a
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-cloudinary/deploys/651d7235e118d10007871fd7
😎 Deploy Preview https://deploy-preview-72--netlify-plugin-cloudinary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -5,7 +5,7 @@ import { JSDOM } from 'jsdom'
import { v2 as cloudinary } from 'cloudinary'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@matiasfha can you check on line 330 of this file where the srcset is updated, can you verify an example with srcset will throw and catch the errors appropriately?

i'm not sure if we have a test for this and additionally may need to add it to the example being tested, but there's no try/catch around it like the other instnace of getCloudinaryUrl

@colbyfayock
Copy link
Collaborator

i created some conflicts in other work im doing, pushed a commit to fix the conflicts and catch up teh branch

@matiasfha matiasfha closed this Sep 20, 2023
@matiasfha matiasfha reopened this Sep 21, 2023
@matiasfha matiasfha marked this pull request as ready for review September 21, 2023 14:39
const cldAssetPath = `/${path.join(PUBLIC_ASSET_PATH, mediaPath)}`;
const cldAssetUrl = `${host}${cldAssetPath}`;

const { cloudinaryUrl: assetRedirectUrl } = await getCloudinaryUrl({
Copy link
Collaborator

Choose a reason for hiding this comment

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

one thing im concerned about here is similar to a previous comment

if getCloudinaryUrl throws an error here - wouldn't it throw an error for the entire try/catch, thus preventing the plugin from continuing to upload other images in the array?

wouldn't it make more sense for the try to wrap the getCloudinaryUrl call alone?

@matiasfha
Copy link
Contributor Author

Updated

@colbyfayock colbyfayock merged commit c90c46f into cloudinary-community:main Oct 4, 2023
@colbyfayock
Copy link
Collaborator

thanks @matiasfha

github-actions bot pushed a commit that referenced this pull request Oct 4, 2023
# [1.12.0](v1.11.0...v1.12.0) (2023-10-04)

### Features

* throw and catch error when calls to cloudinary upload fails ([#72](#72)) ([c90c46f](c90c46f)), closes [#58](#58)
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

🎉 This PR is included in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Test failure logging for uploads
2 participants