Towards strict
This commit is contained in:
parent
367e09599d
commit
acebb86fec
|
@ -32,8 +32,11 @@ const AuthenticatorCodesPage = () => {
|
||||||
try {
|
try {
|
||||||
const res = await getAuthCodes();
|
const res = await getAuthCodes();
|
||||||
setCodes(res);
|
setCodes(res);
|
||||||
} catch (err) {
|
} catch (e) {
|
||||||
if (err.message === CustomError.KEY_MISSING) {
|
if (
|
||||||
|
e instanceof Error &&
|
||||||
|
e.message === CustomError.KEY_MISSING
|
||||||
|
) {
|
||||||
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.AUTH);
|
InMemoryStore.set(MS_KEYS.REDIRECT_URL, PAGES.AUTH);
|
||||||
router.push(PAGES.ROOT);
|
router.push(PAGES.ROOT);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,7 +58,10 @@ export const getAuthCodes = async (): Promise<Code[]> => {
|
||||||
});
|
});
|
||||||
return filteredAuthCodes;
|
return filteredAuthCodes;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message !== CustomError.AUTH_KEY_NOT_FOUND) {
|
if (
|
||||||
|
e instanceof Error &&
|
||||||
|
e.message !== CustomError.AUTH_KEY_NOT_FOUND
|
||||||
|
) {
|
||||||
log.error("get authenticator entities failed", e);
|
log.error("get authenticator entities failed", e);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
|
|
||||||
"jsxImportSource": "@emotion/react",
|
"jsxImportSource": "@emotion/react",
|
||||||
|
|
||||||
"strict": false,
|
"strict": true,
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
/* Stricter than strict */
|
/* Stricter than strict */
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
|
|
|
@ -58,7 +58,8 @@ function SetPasswordForm(props: SetPasswordFormProps) {
|
||||||
setFieldError("confirm", t("PASSPHRASE_MATCH_ERROR"));
|
setFieldError("confirm", t("PASSPHRASE_MATCH_ERROR"));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setFieldError("confirm", `${t("UNKNOWN_ERROR")} ${e.message}`);
|
const message = e instanceof Error ? e.message : "";
|
||||||
|
setFieldError("confirm", `${t("UNKNOWN_ERROR")} ${message}`);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,8 @@ export default function SignUp({ router, appName, login }: SignUpProps) {
|
||||||
setLocalReferralSource(referral);
|
setLocalReferralSource(referral);
|
||||||
await sendOtt(appName, email);
|
await sendOtt(appName, email);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setFieldError("confirm", `${t("UNKNOWN_ERROR")} ${e.message}`);
|
const message = e instanceof Error ? e.message : "";
|
||||||
|
setFieldError("confirm", `${t("UNKNOWN_ERROR")} ${message}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -47,7 +47,8 @@ export default function VerifyTwoFactor(props: Props) {
|
||||||
for (let i = 0; i < 6; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
otpInputRef.current?.focusPrevInput();
|
otpInputRef.current?.focusPrevInput();
|
||||||
}
|
}
|
||||||
setFieldError("otp", `${t("UNKNOWN_ERROR")} ${e.message}`);
|
const message = e instanceof Error ? e.message : "";
|
||||||
|
setFieldError("otp", `${t("UNKNOWN_ERROR")} ${message}`);
|
||||||
}
|
}
|
||||||
setWaiting(false);
|
setWaiting(false);
|
||||||
};
|
};
|
||||||
|
|
|
@ -197,7 +197,10 @@ export default function Credentials({ appContext, appName }: PageProps) {
|
||||||
return keyAttributes;
|
return keyAttributes;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message !== CustomError.TWO_FACTOR_ENABLED) {
|
if (
|
||||||
|
e instanceof Error &&
|
||||||
|
e.message !== CustomError.TWO_FACTOR_ENABLED
|
||||||
|
) {
|
||||||
log.error("getKeyAttributes failed", e);
|
log.error("getKeyAttributes failed", e);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in a new issue