Skip to content

Commit

Permalink
fix: remove dd tag setting from controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
g-tejas committed Jul 10, 2024
1 parent c0a3460 commit 8df12dd
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 21 deletions.
5 changes: 0 additions & 5 deletions src/app/modules/form/admin-form/admin-form.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import {
DatabaseValidationError,
} from '../../core/core.errors'
import { ControllerHandler } from '../../core/core.types'
import { setErrorCode } from '../../datadog/datadog.utils'
import * as FeedbackService from '../../feedback/feedback.service'
import * as EmailSubmissionMiddleware from '../../submission/email-submission/email-submission.middleware'
import * as EmailSubmissionService from '../../submission/email-submission/email-submission.service'
Expand Down Expand Up @@ -1733,7 +1732,6 @@ export const submitEncryptPreview: ControllerHandler<
})
})
.mapErr((error) => {
setErrorCode(error)
const { errorMessage, statusCode } = mapSubmissionError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down Expand Up @@ -1786,7 +1784,6 @@ export const submitEmailPreview: ControllerHandler<
meta: logMeta,
error: formResult.error,
})
setErrorCode(formResult.error)
const { errorMessage, statusCode } = mapEmailSubmissionError(
formResult.error,
)
Expand All @@ -1804,7 +1801,6 @@ export const submitEmailPreview: ControllerHandler<
meta: logMeta,
error: parsedResponsesResult.error,
})
setErrorCode(parsedResponsesResult.error)
const { errorMessage, statusCode } = mapEmailSubmissionError(
parsedResponsesResult.error,
)
Expand Down Expand Up @@ -1857,7 +1853,6 @@ export const submitEmailPreview: ControllerHandler<
meta: logMeta,
error: sendAdminEmailResult.error,
})
setErrorCode(sendAdminEmailResult.error)
const { statusCode, errorMessage } = mapEmailSubmissionError(
sendAdminEmailResult.error,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { createReqMeta } from '../../../utils/request'
import { getFormAfterPermissionChecks } from '../../auth/auth.service'
import * as AuthService from '../../auth/auth.service'
import { ControllerHandler } from '../../core/core.types'
import { setErrorCode } from '../../datadog/datadog.utils'
import {
getStripeOauthUrl,
unlinkStripeAccountFromForm,
Expand Down Expand Up @@ -265,7 +264,6 @@ const _handleUpdatePayments: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { errorMessage, statusCode } = mapRouteError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down
3 changes: 0 additions & 3 deletions src/app/modules/form/public-form/public-form.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { createReqMeta, getRequestIp } from '../../../utils/request'
import { getFormIfPublic } from '../../auth/auth.service'
import * as BillingService from '../../billing/billing.service'
import { ControllerHandler } from '../../core/core.types'
import { setErrorCode } from '../../datadog/datadog.utils'
import {
MYINFO_AUTH_CODE_COOKIE_NAME,
MYINFO_AUTH_CODE_COOKIE_OPTIONS,
Expand Down Expand Up @@ -97,8 +96,6 @@ export const handleGetPublicForm: ControllerHandler<
}
const { errorMessage, statusCode } = mapRouteError(error)

setErrorCode(error)

// Specialized error response for PrivateFormError.
// This is to maintain backwards compatibility with the middleware implementation
if (error instanceof PrivateFormError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as TurnstileMiddleware from '../../../services/turnstile/turnstile.midd
import * as TurnstileService from '../../../services/turnstile/turnstile.service'
import { createReqMeta, getRequestIp } from '../../../utils/request'
import { ControllerHandler } from '../../core/core.types'
import { setErrorCode, setFormTags } from '../../datadog/datadog.utils'
import { setFormTags } from '../../datadog/datadog.utils'
import * as FormService from '../../form/form.service'
import {
MYINFO_LOGIN_COOKIE_NAME,
Expand Down Expand Up @@ -452,7 +452,6 @@ export const submitEmailModeForm: ControllerHandler<
},
)
.mapErr((error) => {
setErrorCode(error)
const { errorMessage, statusCode } = mapRouteError(error)
return res
.status(statusCode)
Expand Down
4 changes: 0 additions & 4 deletions src/app/modules/submission/submission.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { createReqMeta } from '../../utils/request'
import { getFormAfterPermissionChecks } from '../auth/auth.service'
import { DatabaseError } from '../core/core.errors'
import { ControllerHandler } from '../core/core.types'
import { setErrorCode } from '../datadog/datadog.utils'
import { PermissionLevel } from '../form/admin-form/admin-form.types'
import { PaymentNotFoundError } from '../payments/payments.errors'
import { getPopulatedUserById } from '../user/user.service'
Expand Down Expand Up @@ -128,7 +127,6 @@ export const getMetadata: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { statusCode, errorMessage } = mapRouteError(error)
return res.status(statusCode).json({
message: errorMessage,
Expand Down Expand Up @@ -263,7 +261,6 @@ export const handleGetEncryptedResponse: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { statusCode, errorMessage } = mapRouteError(error)
return res.status(statusCode).json({
message: errorMessage,
Expand Down Expand Up @@ -346,7 +343,6 @@ export const streamEncryptedResponses: ControllerHandler<
meta: logMeta,
error: cursorResult.error,
})
setErrorCode(cursorResult.error)
const { statusCode, errorMessage } = mapRouteError(cursorResult.error)
return res.status(statusCode).json({
message: errorMessage,
Expand Down
6 changes: 1 addition & 5 deletions src/app/modules/verification/verification.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createLoggerWithLabel } from '../../config/logger'
import { generateOtpWithHash } from '../../utils/otp'
import { createReqMeta, getRequestIp } from '../../utils/request'
import { ControllerHandler } from '../core/core.types'
import { setErrorCode, setFormTags } from '../datadog/datadog.utils'
import { setFormTags } from '../datadog/datadog.utils'
import * as FormService from '../form/form.service'
import { MyInfoService } from '../myinfo/myinfo.service'
import * as MyInfoUtil from '../myinfo/myinfo.util'
Expand Down Expand Up @@ -60,7 +60,6 @@ export const handleCreateVerificationTransaction: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { errorMessage, statusCode } = mapRouteError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down Expand Up @@ -204,7 +203,6 @@ export const _handleGenerateOtp: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { errorMessage, statusCode } = mapRouteError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down Expand Up @@ -274,7 +272,6 @@ export const _handleOtpVerification: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { statusCode, errorMessage } = mapRouteError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down Expand Up @@ -337,7 +334,6 @@ export const handleResetFieldVerification: ControllerHandler<
meta: logMeta,
error,
})
setErrorCode(error)
const { errorMessage, statusCode } = mapRouteError(error)
return res.status(statusCode).json({ message: errorMessage })
})
Expand Down

0 comments on commit 8df12dd

Please sign in to comment.