Error Object

This error object is OfficeExtension.Error
When any Office JavaScript API request fails to run successfully, the API returns an error object that contains the following properties:


code - The code property of an error message contains a string that is part of the OfficeExtension.ErrorCodes or Excel.ErrorCodes list. For example, the error code "InvalidReference" indicates that the reference is not valid for the specified operation. Error codes are not localized.


message - The message property of an error message contains a summary of the error in the localized string. The error message is not intended for end-user consumption; you should use the error code and appropriate business logic to determine the error message that your add-in shows to end-users.


toString - The message that combines the error code and the message


debugInfo - This hidden object must be logged explicitly. When present, the debugInfo property of the error message provides additional information that you can use to understand the root cause of the error.


Note: If you use console.log() to print error messages to the console, those messages will only be visible on the server. End-users will not see those error messages in the add-in taskpane or anywhere in the host application.


Excel.run ( function (context) { 
}.catch( function (error) {
   if (error.instanceOf OfficeExtension.Error) {
      console.log(error.debugInfo);
   }
}



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext