Skip to content

Commit fcb6f7d

Browse files
committed
Adding specific UI error code for duplicate group name.
1 parent 6e37d15 commit fcb6f7d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

app/V1Module/presenters/GroupsPresenter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,8 @@ private function updateLocalizations(Request $req, Group $group): void
13741374
if ($otherGroup !== $group) {
13751375
throw new InvalidApiArgumentException(
13761376
'name',
1377-
"There is already a group of this name, please choose a different one."
1377+
"There is already a group of this name, please choose a different one.",
1378+
FrontendErrorMappings::E400_504__GROUP_DUPLICATE_NAME
13781379
);
13791380
}
13801381
}

app/exceptions/FrontendErrorMappings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class FrontendErrorMappings
6565
public const E400_502__GROUP_INSTANCE_ROOT_CANNOT_RELOCATE = "400-502";
6666
/** Relocation of a group would create a loop in the tree hierarchy (new parent is a child of a group or group itself). */
6767
public const E400_503__GROUP_RELOCATION_WOULD_CREATE_LOOP = "400-503";
68+
/** Group cannot be created/renamed because another group with the same name already exists in the parent group */
69+
public const E400_504__GROUP_DUPLICATE_NAME = "400-504";
6870

6971
/** General unauthorized */
7072
public const E401_000__UNAUTHORIZED = "401-000";

0 commit comments

Comments
 (0)