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 type { IuserInformations } from "@/utils/requests/types";
import getUserInformations from "@/utils/requests/userInformations";
import { LOG } from "@logger";
import AsyncStorage from "@react-native-async-storage/async-storage";
......@@ -192,8 +192,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const storeAuthenticationData = async (authenticationData: IauthenticationData) => {
try {
await AsyncStorage.setItem("authenticationData", JSON.stringify(authenticationData));
} catch (e) {
log.error("storeAuthenticationData |", e);
} catch (error) {
log.error("storeAuthenticationData |", JSON.stringify(error, null, 2));
// saving error
}
};
......@@ -201,8 +201,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const storeUserInformations = async (userInformations: IuserInformations) => {
try {
await AsyncStorage.setItem("userInformations", JSON.stringify(userInformations));
} catch (e) {
log.error("storeUserInformations |", e);
} catch (error) {
log.error("storeUserInformations |", JSON.stringify(error, null, 2));
// saving error
}
};
......@@ -210,8 +210,8 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const clearStorages = async () => {
try {
await AsyncStorage.clear();
} catch (e) {
log.error("clearStorages |", e);
} catch (error) {
log.error("clearStorages |", JSON.stringify(error, null, 2));
// saving error
}
};
......@@ -242,7 +242,10 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
// navigation.navigate("appBottomTabsNavigator");
}
} 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