fix: Include the maximum document import size in the error message

This commit is contained in:
Tom Moor
2022-09-13 09:09:04 +01:00
parent 7d92b60e97
commit 6bb1b1ac1d

View File

@@ -4,6 +4,7 @@ import { find, orderBy, filter, compact, omitBy } from "lodash";
import { observable, action, computed, runInAction } from "mobx";
import { DateFilter } from "@shared/types";
import { subtractDate } from "@shared/utils/date";
import { bytesToHumanReadable } from "@shared/utils/files";
import naturalSort from "@shared/utils/naturalSort";
import { DocumentValidation } from "@shared/validations";
import BaseStore from "~/stores/BaseStore";
@@ -583,7 +584,11 @@ export default class DocumentsStore extends BaseStore<Document> {
}
if (file.size > env.MAXIMUM_IMPORT_SIZE) {
throw new Error("The selected file was too large to import");
throw new Error(
`The selected file was larger than the ${bytesToHumanReadable(
env.MAXIMUM_IMPORT_SIZE
)} maximum size`
);
}
const title = file.name.replace(/\.[^/.]+$/, "");