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

Catch error viewsLoad() #75

Open
SebastianKempf opened this issue Aug 2, 2017 · 1 comment
Open

Catch error viewsLoad() #75

SebastianKempf opened this issue Aug 2, 2017 · 1 comment
Labels

Comments

@SebastianKempf
Copy link

I implemented jDrupal in a Vue.js Application that I build with webpack and so far it works great. Now, I run into a problem and the solution might be easy but I did not find anything in the documentation or online: I am loading a view with jDrupal.viewsLoad() and it works fine as long as the User has permission to access the view. If he does not have permission nothing is displayed and an “Uncaught (in promise)” error ist log in the console. I was wondering how I can catch this error and eventually display an “Access Denied” message. Usually javascript Promises have a catch function but that does not seem to be the case with jDrupal.viewsLoad() or I am missing something.

@signalpoint
Copy link
Owner

@SebastianKempf thank you for pointing this out. It looks like viewsLoad() isn't watching for errors and never calls the reject, and I'd suspect that is why it is un-catchable. For reference, here's the src code that would need modifying to properly reject the Promise: https://github.com/signalpoint/jDrupal/blob/8.x-1.x/src/includes/views.inc.js#L57

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

No branches or pull requests

2 participants