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

402 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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.

Hover on status