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

3.12.x.error.message.editor.controller.after.metadata.remove #5946

Conversation

wangf1122
Copy link
Collaborator

@wangf1122 wangf1122 commented Sep 7, 2021

The reason.data.error is not a valid according to ApiError class/JSON.

Here is what the response JSON looks like:

image

So the HTTP500 will not be recognized in the popup error window. The simple fix I propose is to do "reason.data.message" instead.

@wangf1122 wangf1122 changed the base branch from main to 3.12.x September 7, 2021 13:59
@josegar74
Copy link
Member

@wangf1122 can you indicate a test case to reproduce the problem?

Does this happen with all exceptions returning an ApiError? I want to be sure the code change can't affect other code potentially returning the error in data.error.message

@wangf1122
Copy link
Collaborator Author

@wangf1122 can you indicate a test case to reproduce the problem?

Does this happen with all exceptions returning an ApiError? I want to be sure the code change can't affect other code potentially returning the error in data.error.message

@josegar74

This is for our customized event listener exception throwing which I made another PR #5945. So I don't know if there is legit case to test in plain vanilla version. I could also change the code to check the original data.error if it's null or not. If it's null use my code otherwise remain as is. Do you think it's safer? For example

var myError = (data.error == null)? data.message: data.error.message;

Then use myError as the file error pass into Angular popup box. So it will be a safety check. I will push that code shortly and you will see it.

@wangf1122
Copy link
Collaborator Author

wangf1122 commented Sep 13, 2021

@josegar74 @ianwallen

I had put exception throwing as part of the API at my local

image

The GlobalExceptionController.java caught it as return as APIError.
image

Then the spinning button will hang forever.

image

I can confirm this issue happens in 3.12.x branch. But it does not happen in main (4.x). I wonder what causes the difference and can we bring any change backport to 4.x?

I suspect the code change in 4.x branch as

$rootScope.$broadcast('StatusUpdated', {
title: reason.data.description,
timeout: 0,
type: 'danger'
});

It uses reason.data.description without the error which avoid causing such problem. It was part of this commit
2de4c28#diff-6773318d8bd3ec673690bfc72667dd510f49e427de9b6c42dfd958778dc18721

Wondering if we can backport this commit into 3.12.x ?

@fxprunayre

I found this file is not changed as what the "EditorBoardController.js" you did. Do you think it should use same response standard as "reason.data.xxxxx" as well because that reason.data.error seems to be broken.

$rootScope.$broadcast('StatusUpdated', {
title: $translate.instant(reason.data.error.message),
error: reason.data.error.description,
timeout: 0,
type: 'danger'
});

@wangf1122
Copy link
Collaborator Author

Close as duplicated from this PR #6029.

@wangf1122 wangf1122 closed this Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants