Add guard clause for errors on ImportExportModal
This commit is contained in:
parent
d2f9684574
commit
d2ea5efa43
@ -103,6 +103,7 @@ function ImportExportModal({
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
backgroundTaskRunningRef.current = false;
|
||||
if (e instanceof(Error)) {
|
||||
if (e.message.startsWith("Max buffer length exceeded")) {
|
||||
setError(
|
||||
new Error(
|
||||
@ -114,6 +115,7 @@ function ImportExportModal({
|
||||
setError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set file input to null to allow adding the same data 2 times in a row
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = "";
|
||||
@ -393,10 +395,12 @@ function ImportExportModal({
|
||||
const blob = new Blob([buffer]);
|
||||
saveAs(blob, `${shortid.generate()}.owlbear`);
|
||||
addSuccessToast("Exported", checkedMaps, checkedTokens);
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof(Error)) {
|
||||
console.error(e);
|
||||
setError(e);
|
||||
}
|
||||
}
|
||||
setIsLoading(false);
|
||||
backgroundTaskRunningRef.current = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user