Include stack trace in errors, Closes #5660
While working on this, i could not get the trace errors higher then the handleRejectedODataPromise & the handleRejectedODataPromise functions. For the tests i had to stub the cli options 🤔 , don't know if there is another, better way
Closes #5660
Thank you @nicodecleyre, we'll have a look at it ASAP!
How can we test how this works @nicodecleyre?
How can we test how this works @nicodecleyre?
I thought of: On the one hand by stubbing the debug option, on the other hand by mocking a stack error. Is there another, better way that you have in mind?
How can we test how this works @nicodecleyre?
I thought of: On the one hand by stubbing the
debugoption, on the other hand by mocking a stack error. Is there another, better way that you have in mind?
I meant more: how can we see it in action. Stubs and mocks are based on assumptions, but how can we confirm that these are correct? How can we use CLI to see how it's handled in practice?
How can we test how this works @nicodecleyre?
I thought of: On the one hand by stubbing the
debugoption, on the other hand by mocking a stack error. Is there another, better way that you have in mind?I meant more: how can we see it in action. Stubs and mocks are based on assumptions, but how can we confirm that these are correct? How can we use CLI to see how it's handled in practice?
Got it, during testing I deliberately entered an incorrect command. For this I have used spo lisitem set with a field that does not exist. In this case 'InvalidField'
Which result in an error witht a stack trace:
Thanks! I'll try that!
Hey @nicodecleyre, are you still working on this?
Hi @waldekmastykarz, I certainly am. I've done some research regarding another solution in every spare time I have, just haven't found it yet
Hi @waldekmastykarz, I investigated this further but the stacktrace has no reference to the cli code files at any time, not even in the command.action. I have also looked for npm modules that could help with this, but they always read from the stack trace, which has no reference to our code files to begin with.
I was wondering if we can formulate a solid solution to this question?
Thanks for looking into it @nicodecleyre. I wonder if it would help, if we caught exceptions in the CLI code and threw a new one, so that we can capture information from the CLI code which we control rather than the dependencies with which we can do nothing.
Thanks for looking into it @nicodecleyre. I wonder if it would help, if we caught exceptions in the CLI code and threw a new one, so that we can capture information from the CLI code which we control rather than the dependencies with which we can do nothing.
A-Mazing, this could go through with it, throwing an error from handleRejectedODataJsonPromise or handleRejectedODataPromise. Thanks a thousand times Waldek!!:
This looks way more meaningful! I'll have a closer look at it asap. Great find! 🚀