From 04d4ed277155781ea226ce85d9c6ec872f87c53d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 18 May 2024 22:01:09 +0700 Subject: [PATCH] Fix last error status was not set/reset properly in sync task --- library.json | 2 +- library.properties | 2 +- src/core/AsyncClient/AsyncClient.h | 15 +++++++++++++++ src/core/Core.h | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/library.json b/library.json index 4fb9f4ee..e1669cad 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "FirebaseClient", - "version": "1.2.1", + "version": "1.2.2", "keywords": "communication, REST, esp32, esp8266, arduino", "description": "Async Firebase Client library for Arduino.", "repository": { diff --git a/library.properties b/library.properties index 83611c2e..2d609b77 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=FirebaseClient -version=1.2.1 +version=1.2.2 author=Mobizt diff --git a/src/core/AsyncClient/AsyncClient.h b/src/core/AsyncClient/AsyncClient.h index 62e03445..b6380cb9 100644 --- a/src/core/AsyncClient/AsyncClient.h +++ b/src/core/AsyncClient/AsyncClient.h @@ -240,6 +240,13 @@ class AsyncClientClass : public ResultBase, RTDBResultBase stop(sData); getResult()->clear(); } + + // Required for sync task. + if (!sData->async) + { + sData->aResult.lastError.clearError(); + lastErr.clearError(); + } } function_return_type sendHeader(async_data_item_t *sData, const char *data) @@ -746,12 +753,20 @@ class AsyncClientClass : public ResultBase, RTDBResultBase sData->aResult.lastError.setClientError(sData->error.code); lastErr.setClientError(sData->error.code); clearAppData(sData->aResult.app_data); + + // Required for sync task. + if (!sData->async) + lastErr.isError(); } else if (sData->response.httpCode > 0 && sData->response.httpCode >= FIREBASE_ERROR_HTTP_CODE_BAD_REQUEST) { sData->aResult.lastError.setResponseError(sData->response.val[res_hndlr_ns::payload], sData->response.httpCode); lastErr.setResponseError(sData->response.val[res_hndlr_ns::payload], sData->response.httpCode); clearAppData(sData->aResult.app_data); + + // Required for sync task. + if (!sData->async) + lastErr.isError(); } } diff --git a/src/core/Core.h b/src/core/Core.h index c1d1168c..0ee80efe 100644 --- a/src/core/Core.h +++ b/src/core/Core.h @@ -7,7 +7,7 @@ #undef FIREBASE_CLIENT_VERSION #endif -#define FIREBASE_CLIENT_VERSION "1.2.1" +#define FIREBASE_CLIENT_VERSION "1.2.2" static void sys_idle() {