ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
327 stars 92 forks source link

setLocation erroneous calls `error` instead of `triggerError` to set error codes #134

Open grmcdorman opened 2 years ago

grmcdorman commented 2 years ago

ezTime.cpp, lines 844 and 859 in current source:

error (SERVER_ERROR);
error (DATA_NOT_FOUND);

Both calls should be triggerError; as is the function returns false at these points, but error() will return 0.

milkpirate commented 2 years ago
--- .pio/libdeps/esp/ezTime/src/ezTime.cpp.org  2019-12-03 21:00:46.000000000 +0100
+++ .pio/libdeps/esp/ezTime/src/ezTime.cpp      2022-01-16 23:18:35.942900700 +0100
@@ -829,7 +829,7 @@
                info(F(" ms)  "));
                if (recv.substring(0,6) == "ERROR ") {
                        _server_error = recv.substring(6);
-                       error (SERVER_ERROR);
+                       triggerError (SERVER_ERROR);
                        return false;
                }
                if (recv.substring(0,3) == "OK ") {
@@ -844,7 +844,7 @@
                        #endif
                        return true;
                }
-               error (DATA_NOT_FOUND);
+               triggerError (DATA_NOT_FOUND);
                return false;
        }

Did the trick for me, thanks.