According to docs:
https://docs.webix.com/desktop__server_graphql.html#serversideresponse
… If the request fails or something goes wrong … we get " errors" field:
{
"data":{"updatePackage":null},
"errors":[{"message":"record not found","path":["updatePackage"]}]
}
But how to catch errors after load ?
Look at source code: https://github.com/webix-hub/webix/blob/master/sources/load/proxy/graphql.js
const GraphQL = {
$proxy:true,
save:function(data){
return this.load(data);
},
load:function(view){
var params = {
query: this.source
};
if (arguments.length === 1){
params.variables = view;
}
return ajax()
.headers({ "Content-type": "application/json" })
.post(this.url, params)
.then(function(data){
return unbox(data.json().data);
});
}
};
there is only data field to return .
Maybe should it be:
return ajax()
.headers({ "Content-type": "application/json" })
.post(this.url, params)
.then(function(data){
const res = data.json();
if (res.errors) throw new Error(res.errors);
return unbox(res.data);
});
Anyway it’s very important to solve this.