Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/sdk/admin/views/organizations/details/edit/billing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function EditBillingPanel({ open = false, onClose }: EditBillingPanelProp
onError: (error) => {
toastManager.add({
title: "Something went wrong",
description: error.message,
description: error.rawMessage,
type: "error",
});
console.error("Unable to update billing details:", error);
Expand Down
2 changes: 1 addition & 1 deletion web/sdk/admin/views/organizations/details/edit/kyc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function EditKYCPanel({ open = false, onClose }: EditKYCPanelProps) {
onClose();
},
onError: (error) => {
toastManager.add({ title: `Failed to update KYC details: ${error.message}`, type: "error" });
toastManager.add({ title: "Failed to update KYC details", description: error.rawMessage, type: "error" });
console.error("Unable to update KYC details:", error);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const AddTokensDialog = ({ onOpenChange }: InviteUsersDialogProps) => {
onError: (error) => {
toastManager.add({
title: "Something went wrong",
description: error.message,
description: error.rawMessage,
type: "error",
});
console.error("Unable to add tokens:", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ export const InviteUsersDialog = ({ onOpenChange }: InviteUsersDialogProps) => {
handleConnectError(error, {
AlreadyExists: () => toastManager.add({ title: 'Invitation already exists', type: "error" }),
InvalidArgument: err =>
toastManager.add({ title: 'Invalid input', description: err.message, type: "error" }),
toastManager.add({ title: 'Invalid input', description: err.rawMessage, type: "error" }),
PermissionDenied: () =>
toastManager.add({ title: "You don't have permission to perform this action", type: "error" }),
Default: err =>
toastManager.add({ title: 'Something went wrong', description: err.message, type: "error" })
toastManager.add({ title: 'Something went wrong', description: err.rawMessage, type: "error" })
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export const RemoveMember = ({
}
toastManager.add({ title: `${t.member({ case: "capital" })} removed successfully`, type: "success" });
} catch (error) {
const message =
error instanceof ConnectError
? error.message
: "Unknown error";
toastManager.add({ title: `Failed to remove ${t.member({ case: "lower" })}: ${message}`, type: "error" });
toastManager.add({
title: `Failed to remove ${t.member({ case: "lower" })}`,
description: error instanceof ConnectError ? error.rawMessage : undefined,
type: "error",
});
console.error(error);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type SearchProjectUsersResponse_ProjectUser,
} from "@raystack/proton/frontier";
import { create } from "@bufbuild/protobuf";
import { ConnectError } from "@connectrpc/connect";
import { useMutation } from "@connectrpc/connect-query";
import styles from "./members.module.css";

Expand Down Expand Up @@ -49,7 +50,11 @@ export const RemoveMember = ({

toastManager.add({ title: `${t.member({ case: "capital" })} removed successfully`, type: "success" });
} catch (error) {
toastManager.add({ title: `Failed to remove ${t.member({ case: "lower" })}`, type: "error" });
toastManager.add({
title: `Failed to remove ${t.member({ case: "lower" })}`,
description: error instanceof ConnectError ? error.rawMessage : undefined,
type: "error",
});
console.error(error);
} finally {
setIsSubmitting(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm, Controller } from "react-hook-form";
import React from "react";
import { ConnectError } from "@connectrpc/connect";
import { useMutation } from "@connectrpc/connect-query";
import { useTerminology } from "../../../../hooks/useTerminology";

Expand Down Expand Up @@ -72,7 +73,11 @@ export function RenameProjectDialog({
});
}
} catch (error) {
toastManager.add({ title: `Failed to rename ${t.project({ case: "lower" })}`, type: "error" });
toastManager.add({
title: `Failed to rename ${t.project({ case: "lower" })}`,
description: error instanceof ConnectError ? error.rawMessage : undefined,
type: "error",
});
console.error(error);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export function useAddProjectMembers({ projectId }: useAddProjectMembersProps) {
handleConnectError(error, {
AlreadyExists: () => toastManager.add({ title: `${memberLabel} already exists in this project`, type: "error" }),
PermissionDenied: () => toastManager.add({ title: "You don't have permission to perform this action", type: "error" }),
InvalidArgument: (err) => toastManager.add({ title: 'Invalid input', description: err.message, type: "error" }),
Default: (err) => toastManager.add({ title: 'Something went wrong', description: err.message, type: "error" }),
InvalidArgument: (err) => toastManager.add({ title: 'Invalid input', description: err.rawMessage, type: "error" }),
Default: (err) => toastManager.add({ title: 'Something went wrong', description: err.rawMessage, type: "error" }),
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const BlockOrganizationDialog = () => {
onError: (error) => {
toastManager.add({
title: "Something went wrong",
description: error.message,
description: error.rawMessage,
type: "error",
});
console.error("Failed to block organization:", error);
Expand All @@ -71,7 +71,7 @@ const BlockOrganizationDialog = () => {
onError: (error) => {
toastManager.add({
title: "Something went wrong",
description: error.message,
description: error.rawMessage,
type: "error",
});
console.error("Failed to unblock organization:", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const DeleteDomainDialog = ({
onError: (error) => {
toastManager.add({
title: "Something went wrong",
description: error.message,
description: error.rawMessage,
type: "error",
});
console.error("Unable to delete domain:", error);
Expand Down
7 changes: 6 additions & 1 deletion web/sdk/admin/views/preferences/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { useCallback, useEffect, useState } from "react";
import Skeleton from "react-loading-skeleton";
import dayjs from "dayjs";
import { ConnectError } from "@connectrpc/connect";
import { useMutation, createConnectQueryKey, useTransport } from "@connectrpc/connect-query";
import { AdminServiceQueries, CreatePreferencesRequestSchema, ListPreferencesResponse } from "@raystack/proton/frontier";
import { Preference, PreferenceTrait, PreferenceTrait_InputType } from "@raystack/proton/frontier";
Expand Down Expand Up @@ -186,7 +187,11 @@ export default function PreferenceDetails({
toastManager.add({ title: "preference updated", type: "success" });
} catch (err) {
console.error("ConnectRPC Error:", err);
toastManager.add({ title: "something went wrong", type: "error" });
toastManager.add({
title: "something went wrong",
description: err instanceof ConnectError ? err.rawMessage : undefined,
type: "error",
});
}
}, [name, value, createPreferences]);

Expand Down
4 changes: 2 additions & 2 deletions web/sdk/admin/views/users/details/security/block-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export const BlockUserDialog = () => {
} catch (error) {
handleConnectError(error, {
PermissionDenied: () => toastManager.add({ title: "You don't have permission to perform this action", type: "error" }),
NotFound: (err) => toastManager.add({ title: 'Not found', description: err.message, type: "error" }),
Default: (err) => toastManager.add({ title: errorMessage, description: err.message, type: "error" }),
NotFound: (err) => toastManager.add({ title: 'Not found', description: err.rawMessage, type: "error" }),
Default: (err) => toastManager.add({ title: errorMessage, description: err.rawMessage, type: "error" }),
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Flex,
Text
} from '@raystack/apsara-v1';
import { ConnectError } from '@connectrpc/connect';
import styles from './sessions.module.css';

interface RevokeSessionFinalConfirmProps {
Expand All @@ -27,7 +28,9 @@ export const RevokeSessionFinalConfirm = ({
} catch (error: any) {
toastManager.add({
title: 'Failed to revoke session',
description: error.message || 'Something went wrong',
description:
(error instanceof ConnectError ? error.rawMessage : error?.message) ||
'Something went wrong',
type: "error",
});
}
Expand Down
4 changes: 2 additions & 2 deletions web/sdk/admin/views/users/list/invite-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export const InviteUser = () => {
} catch (error) {
handleConnectError(error, {
AlreadyExists: () => toastManager.add({ title: 'Invitation already exists', type: "error" }),
InvalidArgument: (err) => toastManager.add({ title: 'Invalid input', description: err.message, type: "error" }),
InvalidArgument: (err) => toastManager.add({ title: 'Invalid input', description: err.rawMessage, type: "error" }),
PermissionDenied: () => toastManager.add({ title: "You don't have permission to perform this action", type: "error" }),
Default: (err) => toastManager.add({ title: 'Something went wrong', description: err.message, type: "error" }),
Default: (err) => toastManager.add({ title: 'Something went wrong', description: err.rawMessage, type: "error" }),
});
}
};
Expand Down
7 changes: 6 additions & 1 deletion web/sdk/admin/views/webhooks/webhooks/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Form, FormSubmit } from "@radix-ui/react-form";
import { CustomFieldName } from "../../../../components/CustomField";
import events from "../../../../utils/webhook-events";
import { ConnectError } from "@connectrpc/connect";
import { useMutation } from "@connectrpc/connect-query";
import {
AdminServiceQueries,
Expand Down Expand Up @@ -69,7 +70,11 @@ export default function CreateWebhooks({ open = false, onClose: onCloseProp }: C
}
} catch (err) {
console.error("Failed to create webhook:", err);
toastManager.add({ title: "Something went wrong", type: "error" });
toastManager.add({
title: "Something went wrong",
description: err instanceof ConnectError ? err.rawMessage : undefined,
type: "error",
});
}
};

Expand Down
7 changes: 6 additions & 1 deletion web/sdk/admin/views/webhooks/webhooks/delete/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button, Dialog, Flex, Text, toastManager } from "@raystack/apsara-v1";
import { ConnectError } from "@connectrpc/connect";
import type { useMutation } from "@connectrpc/connect-query";

interface DeleteWebhookDialogProps {
Expand All @@ -23,7 +24,11 @@ export function DeleteWebhookDialog({
onOpenChange(false);
} catch (err) {
console.error("Failed to delete webhook:", err);
toastManager.add({ title: "Failed to delete webhook", type: "error" });
toastManager.add({
title: "Failed to delete webhook",
description: err instanceof ConnectError ? err.rawMessage : undefined,
type: "error",
});
}
};

Expand Down
7 changes: 6 additions & 1 deletion web/sdk/admin/views/webhooks/webhooks/update/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { Form, FormSubmit } from "@radix-ui/react-form";
import { CustomFieldName } from "../../../../components/CustomField";
import events from "../../../../utils/webhook-events";
import { ConnectError } from "@connectrpc/connect";
import { useMutation } from "@connectrpc/connect-query";
import {
AdminServiceQueries,
Expand Down Expand Up @@ -85,7 +86,11 @@ export default function UpdateWebhooks({ open = false, webhookId: webhookIdProp,
}
} catch (err) {
console.error("Failed to update webhook:", err);
toastManager.add({ title: "Something went wrong", type: "error" });
toastManager.add({
title: "Something went wrong",
description: err instanceof ConnectError ? err.rawMessage : undefined,
type: "error",
});
}
};

Expand Down
Loading