Skip to content

Commit

Permalink
fix(sl): fix error code (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
kishore03109 authored May 12, 2024
1 parent f3fe899 commit 59d1f4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const REDIRECTION_SERVER_IPS = [
"18.138.108.8",
"18.139.47.66",
]
export const ALLOWED_DNS_ERROR_CODES = ["ENOTFOUND", "ENODATA"]

export const DNS_INDIRECTION_DOMAIN = "hostedon.isomer.gov.sg"
export const DNS_INDIRECTION_REPO = "isomer-indirection"
export const ISOMER_ADMIN_EMAIL = "[email protected]"
Expand Down
14 changes: 11 additions & 3 deletions support/routes/v2/formsg/formsgSiteLaunch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import InitializationError from "@errors/InitializationError"

import { getField, getFieldsFromTable } from "@utils/formsg-utils"

import { ISOMER_SUPPORT_EMAIL } from "@root/constants"
import { ALLOWED_DNS_ERROR_CODES, ISOMER_SUPPORT_EMAIL } from "@root/constants"
import { attachFormSGHandler } from "@root/middleware"
import { mailer } from "@root/services/utilServices/MailClient"
import {
Expand Down Expand Up @@ -258,7 +258,11 @@ export class FormsgSiteLaunchRouter {
value: record,
}))
} catch (e) {
if (isErrnoException(e) && e.code === "ENODATA") {
if (
isErrnoException(e) &&
e.code &&
ALLOWED_DNS_ERROR_CODES.includes(e.code)
) {
this.siteLaunchLogger.info({
message: `Domain does not have any AAAA records.`,
meta: {
Expand Down Expand Up @@ -329,7 +333,11 @@ export class FormsgSiteLaunchRouter {

return result
} catch (e) {
if (isErrnoException(e) && e.code === "ENODATA") {
if (
isErrnoException(e) &&
e.code &&
ALLOWED_DNS_ERROR_CODES.includes(e.code)
) {
this.siteLaunchLogger.info({
message: `Domain does not have any CAA records.`,
meta: {
Expand Down

0 comments on commit 59d1f4a

Please sign in to comment.