Skip to content

Commit

Permalink
Fix last error status was not set/reset properly in sync task
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed May 18, 2024
1 parent 30922ba commit 04d4ed2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=FirebaseClient

version=1.2.1
version=1.2.2

author=Mobizt

Expand Down
15 changes: 15 additions & 0 deletions src/core/AsyncClient/AsyncClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 04d4ed2

Please sign in to comment.