Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-side script: If an error is thrown in a Deferred callback, this error doesn't appear in the console, which makes debugging more difficult #501

Open
pomahtri opened this issue Apr 22, 2022 · 1 comment

Comments

@pomahtri
Copy link

pomahtri commented Apr 22, 2022

CodePen example: https://codepen.io/pomah33/pen/MWrRKMb?editors=0010

If an error was thrown in Deferred callback, this error doesn't appear in console, which makes debugging more difficult

Error possibly was caused by this PR: 6d97370#diff-24d8a479ae56566c65690364aa2156fff7613fd38bd024153579f15d92b26f91L73, when deferred-like method .done was changed to promise-like .then

But on error in 'then' section of deferred (not promise) hides without appearing in console

Samples to try in dev console:

new Promise((resolve) => { window.r1 = resolve; }).then(() => { throw new Error('my error'); })
r1()
const d = new $.Deferred()
d.then(() => { throw new Error('my error'); })
d.resolve()
@pomahtri pomahtri changed the title AspNet Store hides error throwed on data loaded AspNet Store hides error thrown on data loaded Apr 22, 2022
@AlekseyMartynov AlekseyMartynov changed the title AspNet Store hides error thrown on data loaded Client-side script: If an error is thrown in a Deferred callback, this error doesn't appear in the console, which makes debugging more difficult Oct 21, 2022
@AlekseyMartynov
Copy link
Contributor

Workaround for jQuery Deferred objects:

$.Deferred.exceptionHook = function(x) {
  console.log(x); 
};

(from https://stackoverflow.com/a/52754647)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants