{"record":{"id":"5556bbe24932e431","repo":"antiwork/gumroad","slug":"sorry-something-went-wrong-please-try-again-5556bb","errorCode":null,"errorMessage":"Sorry, something went wrong. Please try again.","messagePattern":"Sorry, something went wrong\\. Please try again\\.","errorType":"exception","errorClass":"ResponseError","httpStatus":null,"severity":"error","filePath":"app/javascript/pages/Settings/Password/Show.tsx","lineNumber":80,"sourceCode":"      onSuccess: (response) => {\n        if (response.props.new_password) setRequireOldPassword(true);\n        form.reset();\n      },\n    });\n  };\n\n  const handleRemoveAuthenticatorApp = asyncVoid(async () => {\n    setRemovingAuthenticatorApp(true);\n\n    try {\n      const response = await request({\n        url: Routes.settings_totp_path(),\n        method: \"DELETE\",\n        accept: \"json\",\n      });\n      const result = typia.assert<{ success: boolean; error_message?: string }>(await response.json());\n      if (!response.ok || !result.success) {\n        throw new ResponseError(result.error_message ?? \"Sorry, something went wrong. Please try again.\");\n      }\n\n      showAlert(\"Authenticator app removed.\", \"success\");\n      setRegeneratedCodes(null);\n      router.reload();\n    } catch (e) {\n      assertResponseError(e);\n      showAlert(e.message, \"error\");\n    } finally {\n      setRemovingAuthenticatorApp(false);\n    }\n  });\n\n  const handleRegenerateRecoveryCodes = asyncVoid(async () => {\n    setRegenerating(true);\n\n    try {\n      const response = await request({","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/javascript/pages/Settings/Password/Show.tsx#L62-L98","documentation":"Fallback shown when removing the authenticator-app (TOTP) factor fails: DELETE Routes.settings_totp_path. The response is typia-asserted to { success, error_message? }; on !response.ok or success:false it throws ResponseError with the server's error_message or this generic string. assertResponseError in the catch rethrows non-ResponseError exceptions (typia contract violations, network aborts), so real bugs aren't flattened into a toast — only genuine HTTP or success:false outcomes show this message.","triggerScenarios":"DELETE /settings/totp answers 401/419/422/500 without error_message: session or CSRF expiry, TOTP already removed elsewhere (stale UI), or a server exception.","commonSituations":"Two settings tabs open where one already removed TOTP; a long-lived tab with an expired authenticity token; deployments changing the route; policy requiring at least one 2FA method blocking removal.","solutions":["Reload the page; if TOTP is already gone the stale state resolves itself.","Retry the removal after re-authenticating.","Check the DELETE response in devtools — a server error_message would have been shown verbatim.","Maintainers: include error_message in failure JSON and give specific text for policy refusals (e.g. 'At least one 2FA method is required')."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isTotpMutationFailure = (response: Response, result: { success?: boolean }): boolean =>\n  !response.ok || result.success !== true;","tryCatchPattern":"try {\n  const response = await request({ url: Routes.settings_totp_path(), method: \"DELETE\", accept: \"json\" });\n  const result = typia.assert<{ success: boolean; error_message?: string }>(await response.json());\n  if (!response.ok || !result.success) {\n    throw new ResponseError(result.error_message ?? \"Sorry, something went wrong. Please try again.\");\n  }\n} catch (e) {\n  assertResponseError(e); // rethrow non-ResponseError so contract bugs surface\n  showAlert(e.message, \"error\");\n}","preventionTips":["Use assertResponseError to keep typia/network exceptions out of user-facing toasts.","Return error_message for policy refusals (e.g. 'At least one 2FA method is required').","Handle stale UI (TOTP already removed in another tab) by refreshing state on 404."],"tags":["totp","two-factor-authentication","settings","http","security"],"backgroundTag":"http-request-failed","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}