Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor: add diagnostics for file preview error

Brad Barbinb43e569706d3
diff --git a/apps/carbon/app/routes/file+/model+/$bucket.$.tsx b/apps/carbon/app/routes/file+/model+/$bucket.$.tsx
index d129f5a07d..af0519e505 100644
--- a/apps/carbon/app/routes/file+/model+/$bucket.$.tsx
+++ b/apps/carbon/app/routes/file+/model+/$bucket.$.tsx
@@ -41,7 +41,7 @@ export let loader = async ({ params }: LoaderFunctionArgs) => {
(!(fileType in supportedFileTypes) &&
!supportedModelTypes.includes(fileType))
)
- throw new Error("File type not supported");
+ throw new Error(`File type ${fileType} not supported`);
const contentType = supportedFileTypes[fileType];
async function downloadFile() {
diff --git a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
index fbc2c8365a..df1c52eea0 100644
--- a/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
+++ b/apps/carbon/app/routes/file+/preview+/$bucket.$.tsx
@@ -37,7 +37,7 @@ export let loader = async ({ request, params }: LoaderFunctionArgs) => {
(!(fileType in supportedFileTypes) &&
!supportedModelTypes.includes(fileType))
)
- throw new Error("File type not supported");
+ throw new Error(`File type ${fileType} not supported`);
const contentType = supportedFileTypes[fileType];
async function downloadFile() {
diff --git a/apps/mes/app/routes/file+/preview+/$bucket.$.tsx b/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
index fbc2c8365a..df1c52eea0 100644
--- a/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
+++ b/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
@@ -37,7 +37,7 @@ export let loader = async ({ request, params }: LoaderFunctionArgs) => {
(!(fileType in supportedFileTypes) &&
!supportedModelTypes.includes(fileType))
)
- throw new Error("File type not supported");
+ throw new Error(`File type ${fileType} not supported`);
const contentType = supportedFileTypes[fileType];
async function downloadFile() {
diff --git a/packages/react/src/Editor/Editor.tsx b/packages/react/src/Editor/Editor.tsx
index 29fab7b112..084ee91771 100644
--- a/packages/react/src/Editor/Editor.tsx
+++ b/packages/react/src/Editor/Editor.tsx
@@ -62,7 +62,7 @@ const Editor = ({
onUpload: uploadHandler,
validateFn: (file) => {
if (!file.type.includes("image/")) {
- toast.error("File type not supported.");
+ toast.error(`File type ${file.type} not supported.`);
return false;
} else if (file.size / 1024 / 1024 > 20) {
toast.error("File size too big (max 20MB).");