-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Angular should handle errors from backend better #24396
Comments
Is this a regression? I am pretty sure at least 403 have once been handled in another way |
I tested my jhipster7-demo project and the bug happens there too. When you enter a URL for an entity that you don't have access to, you're logged out and redirected to the login page. |
The 401 is caught by Angular in |
Interesting. Totally agree we should fix/change that |
I added a bug bounty. |
Looking at the vue code, I think vue is handling these kind of errors, maybe I was thinking about that (didn't check react) |
@mraible At least for 403 I can't reproduce this. The frontend shows a fine message |
@atomfrede Does this happen when you click on an item that you don't have access to? In my case, I'm changing the ID in the URL. You can clone my example, add a couple of posts that belong to different blogs, then try to access one that you shouldn't be able to. |
Yes I just clicked on the link. Will try it by changing the id in the url. |
@mraible You're right. Entering the url directly in the adressbar leads to an empty page EDIT: I have found the issue, will do a PR later today. TL;DR; the issue is, in case you try to access the page directly a navigation error occurs, which is not handled, while when clicking the link the http request is handled during route transition (which does not occur when accessing the route directly, as far as I remember angular routing) |
Overview of the issue
Today, I noticed that if you return a 401 from a backend method, the Angular UI will redirect you to
/
and log you out. To work around this, I tried returning a 403 instead. This is better because it doesn't log you out but shows a blank screen.Code that throws the exception:
Motivation for or Use Case
The error is in the console, and it should be in the UI too.
Reproduce the error
Create an app with Angular, add the exception to a method, and hit that method with a call from the UI.
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
Environment and Tools
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
git version 2.39.3 (Apple Git-145)
node: v18.18.2
npm: 9.8.1
Docker version 24.0.6, build ed223bc
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
The text was updated successfully, but these errors were encountered: