Skip to content

Commit

Permalink
chore: do not return error on InvalidMobileCountryCodeForPhoneMetadat…
Browse files Browse the repository at this point in the history
…aError
  • Loading branch information
Nicolas Burtey committed Dec 7, 2023
1 parent c7d448c commit 0785224
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/api/src/domain/users/index.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type ChannelType =
type PhoneMetadata = {
// from twilio
carrier: {
error_code: string // check this is the right syntax
mobile_country_code: string
error_code: string | null
mobile_country_code: string | null
mobile_network_code: string | null
name: string | null
type: CarrierType | null
Expand Down
7 changes: 6 additions & 1 deletion core/api/src/domain/users/phone-metadata-validator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { recordExceptionInCurrentSpan } from "@/services/tracing"
import {
InvalidCarrierForPhoneMetadataError,
InvalidCarrierTypeForPhoneMetadataError,
Expand All @@ -7,6 +8,7 @@ import {
} from "./errors"

import { CarrierType } from "@/domain/phone-provider"
import { ErrorLevel } from "../shared"

const checkedToCarrierType = (
rawCarrierType: string | undefined | null,
Expand Down Expand Up @@ -47,7 +49,10 @@ export const PhoneMetadataValidator = (): PhoneMetadataValidator => {
}

if (typeof mobile_country_code !== "string") {
return new InvalidMobileCountryCodeForPhoneMetadataError(mobile_country_code)
recordExceptionInCurrentSpan({
error: new InvalidMobileCountryCodeForPhoneMetadataError(mobile_country_code),
level: ErrorLevel.Critical,
})
}

if (typeof countryCode !== "string") {
Expand Down

0 comments on commit 0785224

Please sign in to comment.