1

In my add-in, when the context.sync().then(function...) throws an exception, this is what it looks like when logging it to the console:
As can be seen, there's no indicator for what line causes this error, which makes the error detection really painful.
How can I get the line in which the error occurs?

EDIT: I'm using Visual Studio 2017.

Thank you so much and have a great day!

3
  • Generally speaking, the "errorLocation" parameter of debugInfo should have more information that will indeed let you pinpoint the issue. Could you post an example of the code that is causing you to hit this issue? Commented Aug 15, 2017 at 20:23
  • This would require posting the entire code block, which is 279 lines in total. So, all I need is that Visual Studio what particular line is causing the problem - I know it exists in the C# environment, so it should be doable in the JavaScript environment as well. Commented Aug 15, 2017 at 20:30
  • Not for an error that comes as part of a "context.sync()" Commented Aug 16, 2017 at 0:22

1 Answer 1

1

In normal JS debugging, the debugger would "just work".

More likely than not, the error is being thrown as part of a context.sync(). This means that technically, the error comes from the host-side processing, not the JS at all. So error.debugInfo.errorLocation is your only way of finding out what the issue is (though it looks like in your case that line is empty -- so we'd need a code repro to see why this is the case).

Screenshot-ting from "Building Office Add-ins using Office.js" (full disclosure, I am the author of said book):

enter image description here

enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.