简体   繁体   中英

How to get error logs in NPM ng2-file-upload in Angular 5?

I am using npm ng2-file-upload package to upload an image file to S3.

I am using onErrorItem hook to know if any error, and I am getting item.isError as true ,

this.uploader.onErrorItem = ((item, response, status, headers): any => { // response=""; status=0; headers={};
          console.log(item.isError);      // true
        });

which means, file upload is failed. I also checked S3 and there was no file. But, there are no error logs about failure in the item object.

By the way, I am uploading a file with a pre-signed-url. This is Github reference

So, can anyone please tell me, how can I see error logs in ng2-file-upload after failing to upload a file in S3?

I found what was the error using Network Tab in Developer Tools in Google Chrome .

But it would have been much quicker if ng2-file-upload had any error logging mechanism.

This is how we can simply check any error coming while you send an API request.

悬停在状态

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM