Skip to content

Commit

Permalink
fix: lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Nov 19, 2024
1 parent f37d0d1 commit 8ac47b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/api/src/domain/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion core/api/src/graphql/error-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
7 changes: 3 additions & 4 deletions core/api/src/servers/authentication/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 8ac47b5

Please sign in to comment.