I'm developing an add-in and I'm encountering an error.
A bunch of stuff is printed to the console, and some of it is:
What does that mean? How do I enable that setting?
I'm developing an add-in and I'm encountering an error.
A bunch of stuff is printed to the console, and some of it is:
What does that mean? How do I enable that setting?
Great question!
Imagine you have code like this:
async function run() {
await Excel.run(async (context) => {
const range = context.workbook.getSelectedRange();
range.getRow(1000).format.fill.color = "yellow";
await context.sync();
});
}
And imagine that your selection is only a small range, such that getRow(1000)
will cause an exception.
If you run this today, you'll get some information:
But note that you don't get the full set of statements, only the "surrounding" ones (which, if you had a bunch of code, might not be enough). And also, that some of the information is "..."-ed out for you.
Now, stick the following line somewhere above your code:
OfficeExtension.config.extendedErrorLogging = true;
Once you have that, you'll get full error logging (which is great for debugging, but please don't do this in production apps -- you don't want to pay the performance cost, and more importantly, you don't want to log and store sensitive data, which might well be present in the log of the full statements (e.g., a 2D values array containing customer info...)
From the Office d.ts file on DefinitelyTyped:
/** Configuration */
var config: {
/**
* Determines whether to log additional error information upon failure.
*
* When this property is set to true, the error object will include a "debugInfo.fullStatements" property that lists all statements in the batch request, including all statements that precede and follow the point of failure.
*
* Setting this property to true will negatively impact performance and will log all statements in the batch request, including any statements that may contain potentially-sensitive data.
* It is recommended that you only set this property to true during debugging and that you never log the value of error.debugInfo.fullStatements to an external database or analytics service.
*/
extendedErrorLogging: boolean;
};
© 2022 - 2024 — McMap. All rights reserved.