Refactor: Update type safety status

This commit is contained in:
gpt-engineer-app[bot]
2025-10-21 17:19:19 +00:00
parent 81fccdc4d0
commit e580f1f4b4
21 changed files with 55 additions and 49 deletions

View File

@@ -213,7 +213,7 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
);
setStep('success');
} catch (error) {
} catch (error: unknown) {
const errorMsg = getErrorMessage(error);
logger.error('Email change failed', {
userId,
@@ -221,7 +221,12 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
error: errorMsg,
});
if (error.message?.includes('rate limit') || error.status === 429) {
const hasMessage = error instanceof Error || (typeof error === 'object' && error !== null && 'message' in error);
const hasStatus = typeof error === 'object' && error !== null && 'status' in error;
const errorMessage = hasMessage ? (error as { message: string }).message : '';
const errorStatus = hasStatus ? (error as { status: number }).status : 0;
if (errorMessage.includes('rate limit') || errorStatus === 429) {
handleError(
new AppError(
'Please wait a few minutes before trying again.',
@@ -230,7 +235,7 @@ export function EmailChangeDialog({ open, onOpenChange, currentEmail, userId }:
),
{ action: 'Change email', userId, metadata: { currentEmail, newEmail: data.newEmail } }
);
} else if (error.message?.includes('Invalid login credentials')) {
} else if (errorMessage.includes('Invalid login credentials')) {
handleError(
new AppError(
'The password you entered is incorrect.',