Commit ab833533 by G

better logging of error cases

parent 6d1b4a31
import type { IuserInformations } from "@/utils/requests/Types";
import authenticateUser from "@/utils/requests/authenticateUser"; import authenticateUser from "@/utils/requests/authenticateUser";
import type { IuserInformations } from "@/utils/requests/types";
import getUserInformations from "@/utils/requests/userInformations"; import getUserInformations from "@/utils/requests/userInformations";
import { LOG } from "@logger"; import { LOG } from "@logger";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
...@@ -192,8 +192,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -192,8 +192,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const storeAuthenticationData = async (authenticationData: IauthenticationData) => { const storeAuthenticationData = async (authenticationData: IauthenticationData) => {
try { try {
await AsyncStorage.setItem("authenticationData", JSON.stringify(authenticationData)); await AsyncStorage.setItem("authenticationData", JSON.stringify(authenticationData));
} catch (e) { } catch (error) {
log.error("storeAuthenticationData |", e); log.error("storeAuthenticationData |", JSON.stringify(error, null, 2));
// saving error // saving error
} }
}; };
...@@ -201,8 +201,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -201,8 +201,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const storeUserInformations = async (userInformations: IuserInformations) => { const storeUserInformations = async (userInformations: IuserInformations) => {
try { try {
await AsyncStorage.setItem("userInformations", JSON.stringify(userInformations)); await AsyncStorage.setItem("userInformations", JSON.stringify(userInformations));
} catch (e) { } catch (error) {
log.error("storeUserInformations |", e); log.error("storeUserInformations |", JSON.stringify(error, null, 2));
// saving error // saving error
} }
}; };
...@@ -210,8 +210,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -210,8 +210,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const clearStorages = async () => { const clearStorages = async () => {
try { try {
await AsyncStorage.clear(); await AsyncStorage.clear();
} catch (e) { } catch (error) {
log.error("clearStorages |", e); log.error("clearStorages |", JSON.stringify(error, null, 2));
// saving error // saving error
} }
}; };
...@@ -242,7 +242,10 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -242,7 +242,10 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
// navigation.navigate("appBottomTabsNavigator"); // navigation.navigate("appBottomTabsNavigator");
} }
} catch (error) { } catch (error) {
} finally { log.error(
"UserAuthenticationContext | App Startup | error during retrieval of stored data |",
JSON.stringify(error, null, 2),
);
} }
})(); })();
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment