diff --git a/core/api/src/domain/errors.ts b/core/api/src/domain/errors.ts index c8058b8b66..199eaa6153 100644 --- a/core/api/src/domain/errors.ts +++ b/core/api/src/domain/errors.ts @@ -116,7 +116,7 @@ export class NoBtcWalletExistsForAccountError extends ValidationError {} export class InvalidQuizQuestionIdError extends ValidationError {} export class QuizClaimedTooEarlyError extends ValidationError {} export class MissingIPMetadataError extends ValidationError {} -export class UndefiniedIPError extends ValidationError { +export class UndefinedIPError extends ValidationError { level = ErrorLevel.Critical } diff --git a/core/api/src/graphql/error-map.ts b/core/api/src/graphql/error-map.ts index 5d08aa885e..2754df983f 100644 --- a/core/api/src/graphql/error-map.ts +++ b/core/api/src/graphql/error-map.ts @@ -658,7 +658,7 @@ export const mapError = (error: ApplicationError): CustomGraphQLError => { case "PhoneCarrierTypeNotAllowedError": case "PhoneCountryNotAllowedError": case "MissingIPMetadataError": - case "UndefiniedIPError": + case "UndefinedIPError": case "UnauthorizedIPMetadataASNError": case "InvalidAccountStatusError": case "InvalidOnChainAddress": diff --git a/core/api/src/servers/authentication/index.ts b/core/api/src/servers/authentication/index.ts index 9c40b8286d..e0a7c102aa 100644 --- a/core/api/src/servers/authentication/index.ts +++ b/core/api/src/servers/authentication/index.ts @@ -10,16 +10,15 @@ import { registerCaptchaGeetest } from "@/app/captcha" import { UNSECURE_IP_FROM_REQUEST_OBJECT } from "@/config" -import { ErrorLevel } from "@/domain/shared" +import { ErrorLevel, parseErrorMessageFromUnknown } from "@/domain/shared" import { parseIps } from "@/domain/accounts-ips" import { checkedToEmailCode, validOneTimeAuthCodeValue } from "@/domain/authentication" import { EmailCodeInvalidError, EmailValidationSubmittedTooOftenError, } from "@/domain/authentication/errors" -import { UndefiniedIPError } from "@/domain/errors" +import { UndefinedIPError } from "@/domain/errors" import { UserLoginIpRateLimiterExceededError } from "@/domain/rate-limit/errors" -import { parseErrorMessageFromUnknown } from "@/domain/shared" import { checkedToEmailAddress, checkedToPhoneNumber } from "@/domain/users" import { @@ -43,7 +42,7 @@ authRouter.use((req: Request, res: Response, next: NextFunction) => { const ipString = UNSECURE_IP_FROM_REQUEST_OBJECT ? req.ip : req.headers["x-real-ip"] const ip = parseIps(ipString) if (!ip) { - recordExceptionInCurrentSpan({ error: new UndefiniedIPError() }) + recordExceptionInCurrentSpan({ error: new UndefinedIPError() }) return res.status(400).send({ error: "IP is not defined" }) } req["originalIp"] = ip as IpAddress