Skip to content

Commit afbab53

Browse files
committed
Add throw Error lines into Save All for GDrive
1 parent 8ae36b0 commit afbab53

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/commons/sagas/PersistenceSaga.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ export function* persistenceSaga(): SagaIterator {
567567
title: 'Saving to Google Drive',
568568
contents: (
569569
<span>
570-
Folder with the same name was found. Overwrite <strong>{topLevelFolderName}</strong>?
570+
Overwrite <strong>{topLevelFolderName}</strong> inside <strong>{saveToDir.name}</strong>?
571571
No deletions will be made remotely, only content updates, but new remote files may be created.
572572
</span>
573573
)
@@ -680,11 +680,7 @@ export function* persistenceSaga(): SagaIterator {
680680
const persistenceFileArray: PersistenceFile[] = yield select((state: OverallState) => state.fileSystem.persistenceFileArray);
681681
for (const currFullFilePath of Object.keys(currFiles)) {
682682
const currFileContent = currFiles[currFullFilePath];
683-
const regexResult = /^(.*[\\\/])?(\.*.*?)(\.[^.]+?|)$/.exec(currFullFilePath);
684-
if (regexResult === null) {
685-
yield call(console.log, "Regex null!");
686-
continue;
687-
}
683+
const regexResult = /^(.*[\\\/])?(\.*.*?)(\.[^.]+?|)$/.exec(currFullFilePath)!;
688684
const currFileName = regexResult[2] + regexResult[3];
689685
//const currFileParentFolders: string[] = regexResult[1].slice(
690686
// ("/playground/" + currFolderObject.name + "/").length, -1)
@@ -696,14 +692,12 @@ export function* persistenceSaga(): SagaIterator {
696692

697693
const currPersistenceFile = persistenceFileArray.find(e => e.path === currFullFilePath);
698694
if (currPersistenceFile === undefined) {
699-
yield call(console.log, "this file is not in persistenceFileArray: ", currFullFilePath); // TODO change to Error?
700-
continue;
695+
throw new Error("this file is not in persistenceFileArray: " + currFullFilePath);
701696
}
702697

703698
if (!currPersistenceFile.id || !currPersistenceFile.parentId) {
704699
// get folder
705-
yield call(console.log, "this file does not have id/parentId: ", currFullFilePath); // TODO change to Error?
706-
continue;
700+
throw new Error("this file does not have id/parentId: " + currFullFilePath);
707701
}
708702

709703
const currFileId = currPersistenceFile.id!;

0 commit comments

Comments
 (0)