Address code review feedback

- Return 400 instead of panicking on invalid organization_id
- Use generic error message for internal failures
- Drop duplicate validation from initiate handler (kept in tx)
- Make preserveConnectionFields mutate in place
- Remove as type assertions in GoogleWorkspaceConnector
- Use sort.Slice instead of sort.SliceStable
- Consistent error prefixes in Slack sender

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-13 18:36:50 +02:00
parent 72478ef6e6
commit 05781d1bbd
5 changed files with 17 additions and 62 deletions

View File

@@ -12,7 +12,7 @@
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
import { formatError, type GraphQLError, sprintf } from "@probo/helpers";
import { sprintf } from "@probo/helpers";
import { useTranslate } from "@probo/i18n";
import {
Badge,
@@ -128,10 +128,7 @@ export function GoogleWorkspaceConnector(props: {
if (errors?.length) {
toast({
title: __("Error"),
description: formatError(
__("Failed to disconnect Google Workspace"),
errors as GraphQLError[],
),
description: errors.map((e) => e.message).join(", "),
variant: "error",
});
return;
@@ -146,10 +143,7 @@ export function GoogleWorkspaceConnector(props: {
onError(error) {
toast({
title: __("Error"),
description: formatError(
__("Failed to disconnect Google Workspace"),
error as GraphQLError,
),
description: error.message,
variant: "error",
});
},
@@ -179,10 +173,7 @@ export function GoogleWorkspaceConnector(props: {
if (errors?.length) {
toast({
title: __("Error"),
description: formatError(
__("Failed to update excluded user names"),
errors as GraphQLError[],
),
description: errors.map((e) => e.message).join(", "),
variant: "error",
});
return;
@@ -196,10 +187,7 @@ export function GoogleWorkspaceConnector(props: {
onError(error) {
toast({
title: __("Error"),
description: formatError(
__("Failed to update excluded user names"),
error as GraphQLError,
),
description: error.message,
variant: "error",
});
},