Ewa.AsyncResult.getDescription()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example

Gets the localized error message.

var value = Ewa.AsyncResult.getDescription();

Return Value

String

Remarks

The [AsyncResult] object is passed as an argument to the method callback specified in the asynchronous method call. If an error occurs during an asynchronous operation, the [AsyncResult] object will contain information about the error. The [AsyncResult.getDescription] method returns the localized error message string that is associated with the error.

Note

[AsyncResult.getDescription] returns an error message only in failure conditions. It does not return a warning message or provide information about the function that executed.

Example

The following code example shows how to get the localized error message associated with an error that resulted from an asynchronous operation.

<script type="text/javascript">
     
var ewa = null;
    
// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOmPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOmPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOmPageLoad() 
{         
    Ewa.EwaControl.add_applicationReady(getEwa); 
} 

function getEwa()
{
    // Get a reference to the Ewa object.
    ewa = Ewa.EwaControl.getInstances().getItem(0);
    getRangeAsync();
}

function getRangeAsync()
{
    // Get a range asynchronously using A1 notation.
    ewa.getActiveWorkbook().getRangeA1Async("Sheet3!B2", getRangeComplete, null);
}

function getRangeComplete(asyncResult)
{    
    // If getRangeA1Async failed, get localized error message.
    if (!asyncResult.getSucceeded())
    {
     asyncResult.getDescription();          
    } // End if.
    
    // Get the range object from the getRangeA1Async call.
    var range = asyncResult.getReturnValue();
       
    // Display the range address in A1 format.
    window.status = range.getAddressA1();
}

</script>

See Also

Reference

Ewa.AsyncResult Methods

Concepts

Ewa Namespace