more detailed error message
This commit is contained in:
parent
de4bbcc137
commit
49bcba0656
Binary file not shown.
|
@ -2,47 +2,44 @@
|
|||
.import QtQuick.LocalStorage 2.0 as Sql
|
||||
|
||||
function friendicaRequest(login,api,rootwindow,callback) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login));
|
||||
if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ if (xhrequest.status=200){ //if (xhrequest.responseText!=""){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error","API:" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
|
||||
//callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){print(e);
|
||||
showMessage("Error", xhrequest.responseText,rootwindow)
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{
|
||||
if (xhrequest.status=200){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error","API:" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send();
|
||||
catch (e){
|
||||
showMessage("Error", login.server+api+"\n"+e+"\n Return: "+xhrequest.responseText,rootwindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send();
|
||||
}
|
||||
|
||||
function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login)+Qt.atob(login.password));
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login)+Qt.atob(login.password));
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ if (xhrequest.responseText!=""){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error",api+" NO RESPONSE",rootwindow)
|
||||
callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
showMessage("Error", api+" "+e,rootwindow)
|
||||
}
|
||||
callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){showMessage("Error", api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
|
||||
}
|
||||
}
|
||||
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send(data);
|
||||
}
|
||||
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send(data);
|
||||
}
|
||||
|
||||
function getCount(database,login,table,field,countvalue){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
|
@ -55,20 +52,17 @@ function getCount(database,login,table,field,countvalue){
|
|||
}
|
||||
|
||||
function friendicaWebRequest(url,rootwindow,callback) {
|
||||
var xhrequest = new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ callback(xhrequest.responseText);
|
||||
}
|
||||
catch (e){print(e);
|
||||
showMessage("Error",url+" "+e, rootwindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", url,true);
|
||||
xhrequest.send();
|
||||
var xhrequest = new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {}
|
||||
else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{callback(xhrequest.responseText)}
|
||||
catch (e){showMessage("Error",url+" "+e+"\n Return: "+xhrequest.responseText, rootwindow)}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", url,true);
|
||||
xhrequest.send();
|
||||
}
|
||||
|
||||
function readData(database,table,username,callback,filter,filtervalue, sort) { // reads and applies data from DB
|
||||
if (filter){
|
||||
|
|
|
@ -2,47 +2,44 @@
|
|||
.import QtQuick.LocalStorage 2.0 as Sql
|
||||
|
||||
function friendicaRequest(login,api,rootwindow,callback) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login));
|
||||
if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ if (xhrequest.status=200){ //if (xhrequest.responseText!=""){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error","API:" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
|
||||
//callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){print(e);
|
||||
showMessage("Error", xhrequest.responseText,rootwindow)
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{
|
||||
if (xhrequest.status=200){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error","API:" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send();
|
||||
catch (e){
|
||||
showMessage("Error", login.server+api+"\n"+e+"\n Return: "+xhrequest.responseText,rootwindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send();
|
||||
}
|
||||
|
||||
function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login)+Qt.atob(login.password));
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
var xhrequest= new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
//print(api+JSON.stringify(login)+Qt.atob(login.password));
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ if (xhrequest.responseText!=""){
|
||||
callback(xhrequest.responseText)
|
||||
}else{
|
||||
showMessage("Error",api+" NO RESPONSE",rootwindow)
|
||||
callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
showMessage("Error", api+" "+e,rootwindow)
|
||||
}
|
||||
callback(xhrequest.responseText)
|
||||
}
|
||||
}
|
||||
catch (e){showMessage("Error", api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
|
||||
}
|
||||
}
|
||||
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send(data);
|
||||
}
|
||||
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));
|
||||
xhrequest.send(data);
|
||||
}
|
||||
|
||||
function getCount(database,login,table,field,countvalue){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
|
@ -55,20 +52,17 @@ function getCount(database,login,table,field,countvalue){
|
|||
}
|
||||
|
||||
function friendicaWebRequest(url,rootwindow,callback) {
|
||||
var xhrequest = new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
|
||||
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{ callback(xhrequest.responseText);
|
||||
}
|
||||
catch (e){print(e);
|
||||
showMessage("Error",url+" "+e, rootwindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", url,true);
|
||||
xhrequest.send();
|
||||
var xhrequest = new XMLHttpRequest();
|
||||
xhrequest.onreadystatechange = function() {
|
||||
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {}
|
||||
else if(xhrequest.readyState === XMLHttpRequest.DONE) {
|
||||
try{callback(xhrequest.responseText)}
|
||||
catch (e){showMessage("Error",url+" "+e+"\n Return: "+xhrequest.responseText, rootwindow)}
|
||||
}
|
||||
}
|
||||
xhrequest.open("GET", url,true);
|
||||
xhrequest.send();
|
||||
}
|
||||
|
||||
function readData(database,table,username,callback,filter,filtervalue, sort) { // reads and applies data from DB
|
||||
if (filter){
|
||||
|
@ -112,7 +106,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
|
|||
});
|
||||
}
|
||||
|
||||
function showMessage(header,message,rootwindow){print("message: "+message);
|
||||
function showMessage(header,message,rootwindow){//print("message: "+message);
|
||||
var cleanmessage=message.replace(/"/g,"-");
|
||||
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';
|
||||
var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput");
|
||||
|
|
Loading…
Reference in a new issue