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

Show errors for Save as Copy action #11761

Merged
merged 2 commits into from
Feb 21, 2022
Merged

Show errors for Save as Copy action #11761

merged 2 commits into from
Feb 21, 2022

Conversation

azrikahar
Copy link
Contributor

Fixes #11722

Before

No error is shown during Save as Copy when a user has no create permission or when a unique value is required:

hAoMpA9NN3

After

Reuse the same logic as save():

if (err?.response?.data?.errors) {
validationErrors.value = err.response.data.errors
.filter((err: APIError) => VALIDATION_TYPES.includes(err?.extensions?.code))
.map((err: APIError) => {
return err.extensions;
});
const otherErrors = err.response.data.errors.filter(
(err: APIError) => VALIDATION_TYPES.includes(err?.extensions?.code) === false
);
if (otherErrors.length > 0) {
otherErrors.forEach(unexpectedError);
}
} else {
unexpectedError(err);
}
throw err;

No Create permission

fjNgPe7xOF

Unique values

(necessary as this is applicable for admin users as well)

MNLJ3nqUcv

@rijkvanzanten rijkvanzanten added this to the v9-next milestone Feb 21, 2022
@rijkvanzanten rijkvanzanten merged commit 8a85e2a into main Feb 21, 2022
@rijkvanzanten rijkvanzanten deleted the issue/11722 branch February 21, 2022 16:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save as Copy errors not shown to the user
2 participants