NSCv3: improve error logging

This commit is contained in:
Milos Kozak 2023-03-02 10:55:31 +01:00
parent dbc4bd0dd6
commit a4c1e724bf
2 changed files with 10 additions and 6 deletions

View file

@ -616,7 +616,7 @@ class NSClientV3Plugin @Inject constructor(
404 -> rxBus.send(EventNSClientNewLog("◄ NOT_FOUND", "${dataPair.value.javaClass.simpleName} ${result.errorResponse}"))
else -> {
rxBus.send(EventNSClientNewLog("◄ ERROR", "ProfileStore"))
rxBus.send(EventNSClientNewLog("◄ ERROR", "${result.errorResponse}"))
return true
}
}
@ -640,7 +640,7 @@ class NSClientV3Plugin @Inject constructor(
404 -> rxBus.send(EventNSClientNewLog("◄ NOT_FOUND", "${dataPair.value.javaClass.simpleName} ${result.errorResponse}"))
else -> {
rxBus.send(EventNSClientNewLog("◄ ERROR", "${dataPair.value.javaClass.simpleName} "))
rxBus.send(EventNSClientNewLog("◄ ERROR", "${result.errorResponse} "))
return true
}
}
@ -684,7 +684,7 @@ class NSClientV3Plugin @Inject constructor(
404 -> rxBus.send(EventNSClientNewLog("◄ NOT_FOUND", "${dataPair.value.javaClass.simpleName} ${result.errorResponse}"))
else -> {
rxBus.send(EventNSClientNewLog("◄ ERROR", "${dataPair.value.javaClass.simpleName} "))
rxBus.send(EventNSClientNewLog("◄ ERROR", "${result.errorResponse} "))
return true
}
}
@ -729,7 +729,7 @@ class NSClientV3Plugin @Inject constructor(
404 -> rxBus.send(EventNSClientNewLog("◄ NOT_FOUND", "${dataPair.value.javaClass.simpleName} ${result.errorResponse}"))
else -> {
rxBus.send(EventNSClientNewLog("◄ ERROR", "${dataPair.value.javaClass.simpleName} "))
rxBus.send(EventNSClientNewLog("◄ ERROR", "${result.errorResponse} "))
return true
}
}
@ -795,7 +795,7 @@ class NSClientV3Plugin @Inject constructor(
404 -> rxBus.send(EventNSClientNewLog("◄ NOT_FOUND", "${dataPair.value.javaClass.simpleName} ${result.errorResponse}"))
else -> {
rxBus.send(EventNSClientNewLog("◄ ERROR", "${dataPair.value.javaClass.simpleName} "))
rxBus.send(EventNSClientNewLog("◄ ERROR", "${result.errorResponse} "))
return true
}
}
@ -859,6 +859,7 @@ class NSClientV3Plugin @Inject constructor(
slowDown()
}
} catch (e: Exception) {
rxBus.send(EventNSClientNewLog("◄ ERROR", e.localizedMessage))
aapsLogger.error(LTag.NSCLIENT, "Upload exception", e)
return false
}

View file

@ -28,7 +28,10 @@ class DataSyncWorker(
dataSyncSelectorV3.doUpload()
rxBus.send(EventNSClientNewLog("► UPL", "End"))
} else {
rxBus.send(EventNSClientNewLog("► ERROR", "Not connected or write permission"))
if (activePlugin.activeNsClient?.hasWritePermission == true)
rxBus.send(EventNSClientNewLog("► ERROR", "No write permission"))
else if (nsClientV3Plugin.wsConnected)
rxBus.send(EventNSClientNewLog("► ERROR", "Not connected"))
// refresh token
nsClientV3Plugin.scheduleIrregularExecution(refreshToken = true)
}