VEException Class

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Contains the exception information for the map control.

Public Properties

Name Description

VEException.source Property

The source object that caused the exception.

VEException.name Property

The name of the exception.

VEException.message Property

A text description of the exception.

Remarks

An exception returned from Bing Maps will always contain a value for the message property. The source and name properties may have values, or may be null or undefined.

If you want to handle VEMap object errors, use the VEMap.onerror Event.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>VEException</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map     = null;

         var shape = null;
         
         var pinCenter = null; 
         
         function GetMap()
         {
            try
            {
               map = new VEMap('myMap');
               map.LoadMap();

               // Add a pushpin using the wrong type 'VEShapeType.Pin'
               //  instead of 'VEShapeType.Pushpin'
               pinCenter = new VELatLong(45.01188,-111.06687);
               shape = new VEShape(VEShapeType.Pin, pinCenter);
               map.AddShape(shape);

             }
             catch(ex)
             {
                //This block will catch VE JavaScript exceptions
                alert("The following exception has occurred: " + ex.name + ", " + ex.message);
             }
          }   
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
   </body>
</html>