isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

fix(sitelaunch): do not throw for no dig results #1355

Closed kishore03109 closed 5 months ago

kishore03109 commented 5 months ago

Problem

When there was no records that were found, dns:node throws an error. While we did handle it, there should have been an additional return statement to exit early rather than propagating into an error state.

Solution

If the error is of type ENODATA, return early with some default values instead.

Breaking Changes

Tests

Locally enter these values into support/routes/v2/formsg/index.ts

formsgSiteLaunchRouter
  .digAAAADomainRecords({
    primaryDomainSource: "singaopreoae.sg",
  } as SiteLaunchResult)
  .then(console.log)
  .catch(console.error)

formsgSiteLaunchRouter
  .digCAADomainRecords({
    primaryDomainSource: "singaopreoae.sg",
  } as SiteLaunchResult)
  .then(console.log)
  .catch(console.error)

assert that the console log outputs

Screenshot 2024-04-30 at 9.24.39 AM.png

Deploy Notes

This fix is meant to go into prod line asap

kishore03109 commented 5 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @kishore03109 and the rest of your teammates on Graphite Graphite