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

Omit console log on undefined before upload rejections #251

Open
nickbabcock opened this issue May 15, 2020 · 0 comments
Open

Omit console log on undefined before upload rejections #251

nickbabcock opened this issue May 15, 2020 · 0 comments

Comments

@nickbabcock
Copy link

When beforeUpload function returns a rejected promise without a value (signifying do not upload) a undefined is logged to the console. It's merely a bit of annoyance, but I don't see the value added by logging undefined. I believe the below patch would fix this by ignoring undefined rejections

diff --git a/src/AjaxUploader.jsx b/src/AjaxUploader.jsx
index 638c90f..849d051 100644
--- a/src/AjaxUploader.jsx
+++ b/src/AjaxUploader.jsx
@@ -113,7 +113,7 @@ class AjaxUploader extends Component {
         }
         return this.post(file);
       }).catch(e => {
-        console && console.log(e); // eslint-disable-line
+        console && e !== undefined && console.log(e); // eslint-disable-line
       });
     } else if (before !== false) {
       setTimeout(() => this.post(file), 0);
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

1 participant