Jump to content

noetherian

Members
  • Posts

    2
  • Joined

  • Last visited

noetherian's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I think I got it. By just removing the first three breaks, I triggered the unknown error case and could see the result. So to answer my own questions: Was it predefined anywhere else? No, and also I understand that it didn't need to be. What will it return? error.UNKNOWN_ERROR simply returns 'undefined' and it's not a problem at all. How can I cause an (intentional) unknown error to trigger this case? I didn't need to cause a specific run-time unknown error to trigger the last case , I just removed the first three breaks and the last case was triggered, so I could see that error.UNKNOWN_ERROR returns 'undefined' and realize that it is just fine. "An unknown error occurred" message is printed on the page as it should be. Thanks!
  2. Hello, A question about this code: function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: x.innerHTML = "User denied the request for Geolocation." break; case error.POSITION_UNAVAILABLE: x.innerHTML = "Location information is unavailable." break; case error.TIMEOUT: x.innerHTML = "The request to get user location timed out." break; case error.UNKNOWN_ERROR: x.innerHTML = "An unknown error occurred." break; } } According to the Geolocation spec. , there are 3 constants representing errors: PERMISSION_DENIED, POSITION_UNAVAILABLE, and TIMEOUT. It doesn't mention UNKNOWN_ERROR So I don't understand how the case of error.UNKNOWN_ERROR fits in the code. Was it predefined anywhere else? what will it return? and how can I cause an (intentional) unknown error to trigger this case? Thank you very much for any assistance.
×
×
  • Create New...