mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Improve error message on load error
This commit is contained in:
parent
e0c18b9439
commit
a3126f8532
@ -45,6 +45,9 @@ class LocalStorageManager extends PersistenceManager {
|
||||
success(response) {
|
||||
xml = response;
|
||||
},
|
||||
error(xhr, ajaxOptions, thrownError) {
|
||||
console.error(`Request error => status:${xhr.status} ,thrownError: ${thrownError}`);
|
||||
},
|
||||
});
|
||||
// If I could not load it from a file, hard code one.
|
||||
if (xml == null) {
|
||||
|
@ -108,6 +108,9 @@ class RESTPersistenceManager extends PersistenceManager {
|
||||
async: false,
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/json; charset=utf-8', Accept: 'application/json' },
|
||||
error(xhr, ajaxOptions, thrownError) {
|
||||
console.error(`Request error => status:${xhr.status} ,thrownError: ${thrownError}`);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -119,6 +122,9 @@ class RESTPersistenceManager extends PersistenceManager {
|
||||
method: 'put',
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
data: 'false',
|
||||
error(xhr, ajaxOptions, thrownError) {
|
||||
console.error(`Request error => status:${xhr.status} ,thrownError: ${thrownError}`);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -147,11 +153,14 @@ class RESTPersistenceManager extends PersistenceManager {
|
||||
success(responseText) {
|
||||
xml = responseText;
|
||||
},
|
||||
error(xhr, ajaxOptions, thrownError) {
|
||||
console.error(`Request error => status:${xhr.status} ,thrownError: ${thrownError}`);
|
||||
},
|
||||
});
|
||||
|
||||
// If I could not load it from a file, hard code one.
|
||||
if (xml == null) {
|
||||
throw new Error('Map could not be loaded');
|
||||
throw new Error(`Map with id ${mapId} could not be loaded`);
|
||||
}
|
||||
|
||||
return xml;
|
||||
|
Loading…
Reference in New Issue
Block a user