add error handling to continuousExport toggle functions
This commit is contained in:
parent
8f14580bb5
commit
4866651913
|
@ -84,14 +84,15 @@ export default function ExportModal(props: Props) {
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isElectron()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (continuousExport) {
|
||||
exportService.enableContinuousExport(startExport);
|
||||
} else {
|
||||
exportService.disableContinuousExport();
|
||||
}
|
||||
} catch (e) {
|
||||
logError(e, 'error handling continuousExport change');
|
||||
}
|
||||
}, [continuousExport]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -77,6 +77,7 @@ class ExportService {
|
|||
}
|
||||
|
||||
enableContinuousExport(startExport: () => void) {
|
||||
try {
|
||||
if (this.continuousExportEventListener) {
|
||||
return;
|
||||
}
|
||||
|
@ -93,9 +94,14 @@ class ExportService {
|
|||
Events.LOCAL_FILES_UPDATED,
|
||||
this.continuousExportEventListener
|
||||
);
|
||||
} catch (e) {
|
||||
logError(e, 'failed to enableContinuousExport ');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
disableContinuousExport() {
|
||||
try {
|
||||
if (!this.continuousExportEventListener) {
|
||||
return;
|
||||
}
|
||||
|
@ -103,6 +109,11 @@ class ExportService {
|
|||
Events.LOCAL_FILES_UPDATED,
|
||||
this.continuousExportEventListener
|
||||
);
|
||||
this.continuousExportEventListener = null;
|
||||
} catch (e) {
|
||||
logError(e, 'failed to disableContinuousExport');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
stopRunningExport() {
|
||||
|
|
Loading…
Reference in a new issue