Skip to content

Commit

Permalink
slight refactor of logValidationErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
ichub committed Dec 19, 2023
1 parent 0509323 commit b7c881d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions apps/passport-client/src/validateState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,20 @@ export function getRunningAppStateValidationErrors(
* we have records and are able to identify common types of errors. Does not leak
* sensitive information, such as decrypted versions of e2ee storage.
*/
export async function logValidationErrors(errors: ErrorReport): Promise<void> {
export async function logValidationErrors(
errorReport: ErrorReport
): Promise<void> {
if (errorReport?.errors?.length === 0) {
console.log(`not logging empty error report`);
return;
}

try {
const user = loadSelf();
errors.userUUID = errors.userUUID ?? user?.uuid;
console.log(`encountered state validation errors: `, errors);
errorReport.userUUID = errorReport.userUUID ?? user?.uuid;
console.log(`encountered state validation errors: `, errorReport);
await requestLogToServer(appConfig.zupassServer, "state-validation-error", {
...errors
...errorReport
});
} catch (e) {
console.log("error reporting errors", e);
Expand Down

0 comments on commit b7c881d

Please sign in to comment.