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

403 (forbidden) error message incorrect on Angular UI? #2763

Closed
olicooper opened this issue Feb 5, 2020 · 1 comment
Closed

403 (forbidden) error message incorrect on Angular UI? #2763

olicooper opened this issue Feb 5, 2020 · 1 comment

Comments

@olicooper
Copy link
Contributor

olicooper commented Feb 5, 2020

When trying to delete a static role (to test a forbidden response), I noticed that the returned error message was generic.
image
When looking at the response I can see the error code is "Static roles can not be deleted.", however I think this should be in the message instead of "An internal error occurred during your request!" which is a 500 error response?
image

this.actions.pipe(ofActionSuccessful(RestOccurError, RouterError, RouterDataResolved)).subscribe(res => {
if (res instanceof RestOccurError) {
const { payload: err = {} as HttpErrorResponse | any } = res;
const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULT_ERROR_MESSAGES.defaultError.title);

@olicooper
Copy link
Contributor Author

If a 'code' value is supplied in the error without any 'details', would it be good to display this to the user for support purposes?

private showError(
    message?: Config.LocalizationParam,
    title?: Config.LocalizationParam,
    body?: any,
  ): Observable<Toastr.Status> {
    if (body) {
      if (body.details) {
        message = body.details;
        title = body.message;
      } else if (body.code) {
        message = body.code;
        title = body.message;
      } else {
        message = body.message || DEFAULT_ERROR_MESSAGES.defaultError.title;
      }
    }

@mehmet-erim mehmet-erim added this to the 2.0.2 milestone Feb 6, 2020
@hikalkan hikalkan modified the milestones: 2.0.2, 2.1 Feb 6, 2020
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

3 participants