none
Map functions failing silently, not logging to console RRS feed

  • Question

  • There have been a few bugs on my project recently that have failed silently due to the Bing Maps v8 Web Control catching the errors and not logging them. If these errors are going to be caught in the Bing code, shouldn't there at least be a debug mode option that logs them to the console?

    The specific errors that occurred were trying to create a Location with an invalid latitude and trying to create a LocationRect from an empty array.

    Thursday, January 26, 2017 4:59 PM

Answers

  • Doing either of these throws and error. You have to wrap the code with a try/catch if you want to handle it. You can then write it to the console. This is pretty standard in just about all development technologies I have used. Here is a code sample:

    try{
        var location = new Microsoft.Maps.Location(180, 180);
    } catch (e) {
        console.log(e.message);
    }
    
    try {
        var bounds = Microsoft.Maps.LocationRect.fromLocations([]);
    } catch (e) {
        console.log(e.message);
    }


    [Blog] [twitter] [LinkedIn]

    Thursday, January 26, 2017 6:04 PM
  • We had one error write to the console in the past and we recieved a ton of negative feedback from customers. You own the console for your app, not us, Bing Maps will simply throw an error when one occurs.


    [Blog] [twitter] [LinkedIn]

    Friday, January 27, 2017 8:08 PM

All replies

  • Doing either of these throws and error. You have to wrap the code with a try/catch if you want to handle it. You can then write it to the console. This is pretty standard in just about all development technologies I have used. Here is a code sample:

    try{
        var location = new Microsoft.Maps.Location(180, 180);
    } catch (e) {
        console.log(e.message);
    }
    
    try {
        var bounds = Microsoft.Maps.LocationRect.fromLocations([]);
    } catch (e) {
        console.log(e.message);
    }


    [Blog] [twitter] [LinkedIn]

    Thursday, January 26, 2017 6:04 PM
  • Thanks for the quick response, but I would have expected the error to be logged to the console without me catching it and logging it myself. It looks like it is getting buried somewhere in between the Bing code, Angular and the Promise polyfill. I will keep digging.
    Friday, January 27, 2017 7:59 PM
  • We had one error write to the console in the past and we recieved a ton of negative feedback from customers. You own the console for your app, not us, Bing Maps will simply throw an error when one occurs.


    [Blog] [twitter] [LinkedIn]

    Friday, January 27, 2017 8:08 PM
  • That makes sense. Thanks for your input!
    Monday, January 30, 2017 8:34 PM