Better error messages for invalid project IDs/missing files

This commit is contained in:
Thomas Weber committed 2021-06-24 14:09:01 -05:00
1 parent e693ff81a8
commit 04e08ef018
1 file changed
+6 -1
+6 -1
View File
@@ -73,7 +73,9 @@
};
if ($type === 'id') {
const match = $projectId.match(/\d+/);
if (!match) throw new Error('no project selected');
if (!match) {
throw new Error('Invalid project ID');
}
const id = match[0];
newProjectData.uniqueId = `#${id}`;
newProjectData.projectId = id;
@@ -81,6 +83,9 @@
const data = await res.arrayBuffer();
await vm.loadProject(data);
} else {
if (!files) {
throw new Error('No file selected');
}
const file = files[0];
newProjectData.projectId = null;
newProjectData.uniqueId = `@${file.name}`;