Closed SamyCookie closed 1 year ago
Hey @SamyCookie,
I understand that it can be frustrating to have some duplicated entries in the stack trace. However, the behaviour seems to be different based on the browser used.
Given the following snippet:
<script type="module">
import wretch from "https://unpkg.com/wretch?module";
wretch("https://httpstat.us/401").get().text(console.log)
</script>
Here is a screenshot from Chrome…
…and here is one from Firefox.
As you can see in Chrome there is no perceived issue.
Furthermore the change has been originally requested a while ago because not having the full stack trace caused issues with tools like Sentry: https://github.com/elbywan/wretch/issues/98
Given these reasons, and the fact that I don't find it that critical to have some duplicated lines sometimes I am not keen on changing the code.
I understand ! Thanks for the answer ! :)
Concatenate stacks is useless since https://caniuse.com/mdn-javascript_builtins_error_cause implementation. This tends to be more tricky to understand stacks than it helps.
https://github.com/elbywan/wretch/blob/d18ef68a6c9e0bbf5f9cc24199fa3bd15e7fc2cf/src/resolver.ts#L44
I recommend to remove the
+ "\nCAUSE: " + referenceError.stack
.Example: