Warn on invalid JSON file (#1159)

* add error dialog

* show error modal on file dnd

* add locales

* Update src/locales/en.json

Co-Authored-By: Lipis <lipiridis@gmail.com>

* Update src/data/blob.ts

* Update src/data/blob.ts

* fix titles, update snapshots

* make modal smaller

* fix dnd wrong file type

* reset errorMessage

Co-authored-by: Faustino Kialungila <faustino.kialungila@gmail.com>
Co-authored-by: Lipis <lipiridis@gmail.com>
This commit is contained in:
Kostas Bariotis 2020-04-03 12:50:51 +01:00 committed by GitHub
parent 2be34effd4
commit 0c9459e9e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 108 additions and 7 deletions

View file

@ -64,11 +64,14 @@ export const actionLoadScene = register({
perform: (
elements,
appState,
{ elements: loadedElements, appState: loadedAppState },
{ elements: loadedElements, appState: loadedAppState, error },
) => {
return {
elements: loadedElements,
appState: loadedAppState,
appState: {
...loadedAppState,
errorMessage: error,
},
commitToHistory: false,
};
},
@ -84,7 +87,9 @@ export const actionLoadScene = register({
.then(({ elements, appState }) => {
updateData({ elements: elements, appState: appState });
})
.catch((error) => console.error(error));
.catch((error) => {
updateData({ error: error });
});
}}
/>
),