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