Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

fix: enhance error handling for data pool and datasource operations

Muhammad Hamza Khan6ca7ea521d68
diff --git a/packages/app/src/react/features/data-pool/client/datapool.client.ts b/packages/app/src/react/features/data-pool/client/datapool.client.ts
index 8dd056a5..4038a162 100644
--- a/packages/app/src/react/features/data-pool/client/datapool.client.ts
+++ b/packages/app/src/react/features/data-pool/client/datapool.client.ts
@@ -125,6 +125,9 @@ export const dataPoolClient = {
if (error instanceof Error) {
throw error;
}
+ if (error.status === 403) {
+ throw new Error('You don\'t have permission to create a new data space');
+ }
throw new Error(extractErrorMessage(error, 'Failed to create namespace'));
}
},
@@ -176,7 +179,7 @@ export const dataPoolClient = {
} catch (error) {
if (error instanceof Error) throw error;
if (error.status === 403) {
- throw new Error("You don't have permission to delete this data space");
+ throw new Error('You don\'t have permission to delete this data space');
}
throw new Error('Failed to delete namespace');
}
diff --git a/packages/app/src/react/features/data-pool/client/datasource.client.ts b/packages/app/src/react/features/data-pool/client/datasource.client.ts
index 53d99adf..16c035a0 100644
--- a/packages/app/src/react/features/data-pool/client/datasource.client.ts
+++ b/packages/app/src/react/features/data-pool/client/datasource.client.ts
@@ -85,6 +85,9 @@ export const datasourceClient = {
if (error instanceof Error) {
throw error;
}
+ if (error.status === 403) {
+ throw new Error('You don\'t have permission to create a new datasource');
+ }
throw new Error(extractErrorMessage(error, 'Failed to create datasource'));
}
},
@@ -113,6 +116,9 @@ export const datasourceClient = {
if (error instanceof Error) {
throw error;
}
+ if (error.status === 403) {
+ throw new Error('You don\'t have permission to delete this datasource');
+ }
throw new Error('Failed to delete datasource');
}
},
diff --git a/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx b/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
index ee4567b5..50e29255 100644
--- a/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
+++ b/packages/app/src/react/features/data-pool/components/CreateNamespaceModal.tsx
@@ -142,7 +142,6 @@ export const CreateNamespaceModal: FC<CreateNamespaceModalProps> = ({
onClose();
} catch (err) {
const errorMessage = err?.message || 'Failed to create data space. Please try again.';
- setError(errorMessage);
errorToast(errorMessage);
} finally {
setIsCreating(false);
diff --git a/packages/app/src/react/features/data-pool/components/UploadDatasourceDialog.tsx b/packages/app/src/react/features/data-pool/components/UploadDatasourceDialog.tsx
index 67aa9352..b875d041 100644
--- a/packages/app/src/react/features/data-pool/components/UploadDatasourceDialog.tsx
+++ b/packages/app/src/react/features/data-pool/components/UploadDatasourceDialog.tsx
@@ -180,7 +180,6 @@ export const UploadDatasourceDialog: FC<UploadDatasourceDialogProps> = ({
} catch (error: unknown) {
const errorMessage = (error as Error)?.message || 'Failed to upload datasource';
errorToast(errorMessage);
- setError(errorMessage);
} finally {
setIsUploading(false);
}