1

I have get a request from an API, some times I would get the EXIF information, but sometimes I will get error message {"error":"no exif data"} How can I hide this error message. In chrome, the error is 400 (Bad Request)

$http.get(res.getQNUrl(domain, key, "exif"))
    .success(function(data){
        $scope.imageExifMap[key] = data
    }).error(function(data,status,headers,config){})
lincolnge
  • 1,037
  • 14
  • 19
  • 2
    you want to hide error message from chrome console ? :) – Narek Mamikonyan Jul 25 '14 at 07:45
  • You can't. That bad request error is handled by your browser, an angular exception handler also won't do it. – Mohammad Sepahvand Jul 25 '14 at 07:45
  • 1
    Normally we just handle the error like you've shown above. We don't worry that an error shows in the console. Are you worried about the console, or is your error handler not being invoked, or something else? – Sunil D. Jul 25 '14 at 07:49
  • 2
    To get it to not show in the console you'd have to do a really hacky thing and return a 200 ok message from the server and then in the object returned have the correct error code. Absolutely horrible, don't do this. But thats the only way I'd think of. Though hiding it from the console seems like a pointless objective anyways – David Esteves Jul 25 '14 at 08:00

1 Answers1

0

The error message you mentioned above is browser specific. It is a browser logging functionality.

Well there is a workaround(not a solution since its not a problem) for it. I would not recommend it since its a built-in browser functionality you are trying to suppress from doing the task it is meant to do, but if that is what you want then here are couple of ways to achieve it.

  • Using a regular expression filter like so

    ^(?!.* 404 \(Not Found\))(?!.*[file name])

  • Using a Log filter like so

enter image description here

I have not explained it much because there is already an SO question that explains these in detail.

Please refer this SO for detailed explanation regarding the above mentioned workarounds.

Community
  • 1
  • 1
Nikhil Nanjappa
  • 6,454
  • 3
  • 28
  • 44