FACG6 / emotion-detector

Our Website
https://emotionandfacerecognizer.herokuapp.com/
0 stars 0 forks source link

Handling Error #31

Open IsraaSulaiman opened 5 years ago

IsraaSulaiman commented 5 years ago

In the fetch file:

   if (JSON.parse(xhr.responseText))

I'm not sure if this really works. I tried to print "hi" within its block when the response is not jason but it did not print anything.

I recommend you use this code:

  if(xhr.getResponseHeader('content-type') !=='application/json'){
    cb(`No Valid Data`);