Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

Merged
colbyfayock merged 3 commits into cloudinary-community:main from matiasfha:fix/58
Oct 4, 2023

Conversation

@matiasfha
Copy link
Contributor

@matiasfha matiasfha commented Sep 15, 2023
edited
Loading

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

Copy link

netlify bot commented Sep 15, 2023
edited
Loading

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.

import path from 'path'
import fetch from 'node-fetch'
import { JSDOM } from 'jsdom'
import { v2 as cloudinary } from 'cloudinary'
Copy link
Collaborator

@colbyfayock colbyfayock Sep 15, 2023

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

Copy link
Collaborator

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

const cldAssetPath = `/${path.join(PUBLIC_ASSET_PATH, mediaPath)}`;
const cldAssetUrl = `${host}${cldAssetPath}`;

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

@colbyfayock colbyfayock Sep 22, 2023

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?

Copy link
Contributor Author

Updated

@colbyfayock colbyfayock merged commit c90c46f into cloudinary-community:main Oct 4, 2023
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)
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 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colbyfayock colbyfayock Awaiting requested review from colbyfayock

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Test failure logging for uploads

AltStyle によって変換されたページ (->オリジナル) /