case 4489
This commit is contained in:
@@ -83,6 +83,7 @@ function handleError(action, error, route) {
|
||||
|
||||
export default {
|
||||
status(response) {
|
||||
//############ THIS IS DEPRECATED IN FAVOR OF STATUSEX BELOW ##################
|
||||
//Handle expected api errors
|
||||
if (response.status == 401) {
|
||||
throw new Error("LT:ErrorUserNotAuthenticated");
|
||||
@@ -121,7 +122,7 @@ export default {
|
||||
return Promise.resolve(response);
|
||||
}
|
||||
},
|
||||
statusEx(response) {
|
||||
statusEx(response, data) {
|
||||
//Handle expected api errors
|
||||
if (response.status == 401) {
|
||||
throw new Error("LT:ErrorUserNotAuthenticated");
|
||||
@@ -143,6 +144,23 @@ export default {
|
||||
throw new Error("Method Not Allowed (route issue?) " + response.url);
|
||||
}
|
||||
|
||||
//Bad request error need to see the request in the log for troubleshooting more esoteric errors remotely
|
||||
//case 4485
|
||||
if (response.status == 400) {
|
||||
window.$gz.store.commit(
|
||||
"logItem",
|
||||
"API error: status=" +
|
||||
response.status +
|
||||
", statusText=" +
|
||||
response.statusText +
|
||||
", url=" +
|
||||
response.url +
|
||||
", request data=" +
|
||||
JSON.stringify(data)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
return;
|
||||
} else {
|
||||
@@ -465,7 +483,7 @@ export default {
|
||||
}
|
||||
|
||||
let r = await fetch(that.APIUrl(route), fetchOptions);
|
||||
that.statusEx(r);
|
||||
that.statusEx(r, data);
|
||||
r = await that.extractBodyEx(r);
|
||||
return r;
|
||||
} catch (error) {
|
||||
@@ -501,7 +519,7 @@ export default {
|
||||
try {
|
||||
const that = this;
|
||||
let r = await fetch(that.APIUrl(route), that.fetchPutOptions(data));
|
||||
that.statusEx(r);
|
||||
that.statusEx(r, data);
|
||||
r = await that.extractBodyEx(r);
|
||||
return r;
|
||||
} catch (error) {
|
||||
@@ -515,7 +533,7 @@ export default {
|
||||
try {
|
||||
const that = this;
|
||||
let r = await fetch(that.APIUrl(route), that.fetchPostOptions(data));
|
||||
that.statusEx(r);
|
||||
that.statusEx(r, data);
|
||||
r = await that.extractBodyEx(r);
|
||||
return r;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user