Throughout the code samples in this documentation, you'll notice that every call to
Excel.run is accompanied by a
catch statement to catch any errors that occur within the
codeproperty of an error message contains a string that is part of the
Excel.ErrorCodeslist. For example, the error code "InvalidReference" indicates that the reference is not valid for the specified operation. Error codes are not localized.
messageproperty 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.
debugInfo: When present, the
debugInfoproperty of the error message provides additional information that you can use to understand the root cause of the error.
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.