Procházet zdrojové kódy

feat: add a proper error message when file is too big (#2247)

Pierre-Monier před 4 roky
rodič
revize
41ccd47791
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 2 1
      src/data/index.ts
  2. 1 0
      src/locales/en.json

+ 2 - 1
src/data/index.ts

@@ -218,8 +218,9 @@ export const exportToBackend = async (
       // of queryParam in order to never send it to the server
       url.hash = `json=${json.id},${exportedKey.k!}`;
       const urlString = url.toString();
-
       window.prompt(`🔒${t("alerts.uploadedSecurly")}`, urlString);
+    } else if (json.error_class === "RequestTooLargeError") {
+      window.alert(t("alerts.couldNotCreateShareableLinkTooBig"));
     } else {
       window.alert(t("alerts.couldNotCreateShareableLink"));
     }

+ 1 - 0
src/locales/en.json

@@ -109,6 +109,7 @@
   "alerts": {
     "clearReset": "This will clear the whole canvas. Are you sure?",
     "couldNotCreateShareableLink": "Couldn't create shareable link.",
+    "couldNotCreateShareableLinkTooBig": "Couldn't create shareable link: the scene is too big",
     "couldNotLoadInvalidFile": "Couldn't load invalid file",
     "importBackendFailed": "Importing from backend failed.",
     "cannotExportEmptyCanvas": "Cannot export empty canvas.",