{"record":{"id":"58966cca1e133970","repo":"antiwork/gumroad","slug":"sorry-something-went-wrong-please-try-again-58966c","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/TaxCenter/Index.tsx","lineNumber":118,"sourceCode":"  const { documents, available_years, selected_year } = typia.assert<{\n    documents: TaxDocument[];\n    available_years: number[];\n    selected_year: number | null;\n  }>(usePage().props);\n  const loggedInUser = useLoggedInUser();\n  const [isLoading, setIsLoading] = React.useState(false);\n  const [downloadingFormType, setDownloadingFormType] = React.useState<string | null>(null);\n  const [requestingReportFormType, setRequestingReportFormType] = React.useState<string | null>(null);\n\n  const handleRequestTransactionReport = asyncVoid(async (doc: TaxDocument) => {\n    setRequestingReportFormType(doc.form_type);\n    try {\n      const response = await request({\n        method: \"POST\",\n        accept: \"json\",\n        url: Routes.tax_form_transaction_report_path(doc.year),\n      });\n      if (!response.ok) throw new ResponseError();\n      showAlert(\"You will receive an email shortly with your transaction report.\", \"success\");\n    } catch (e) {\n      assertResponseError(e);\n      showAlert(\"Sorry, something went wrong. Please try again.\", \"error\");\n    }\n    setRequestingReportFormType(null);\n  });\n\n  const handleYearChange = (year: number) => {\n    router.reload({\n      data: { year },\n      onStart: () => setIsLoading(true),\n      onFinish: () => setIsLoading(false),\n      onError: () => showAlert(\"Something went wrong. Please try again.\", \"error\"),\n    });\n  };\n\n  const handleDownload = (_e: React.MouseEvent<HTMLAnchorElement>, formType: string) => {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/javascript/pages/TaxCenter/Index.tsx#L100-L136","documentation":"Generic toast shown when requesting a tax-year transaction report fails: POST Routes.tax_form_transaction_report_path(doc.year) with accept:json. Any !response.ok throws a bare ResponseError() (default 'Something went wrong.'), and the catch unconditionally shows this fixed 'Sorry, something went wrong. Please try again.' — the response body is never read, so unlike sibling handlers there is no server-message passthrough. assertResponseError still rethrows non-ResponseError exceptions, so typia/network bugs don't become a toast.","triggerScenarios":"POST /tax_forms/:year/transaction_report returns 401/419/422/500: expired session, year out of range, report generation job failing to enqueue, or a server exception. No body is parsed, so this is purely an HTTP-status outcome.","commonSituations":"Tax-center tabs left open past session expiry, report workers backed up or erroring, or invalid year values from stale UI state.","solutions":["Reload the tax center page and retry the report request.","Verify the selected tax year is one you had transactions in.","Check the network tab: the failed POST's status code distinguishes auth (401/419) from server (5xx).","Maintainers: read the response body and show its error like sibling handlers do, instead of a fixed string."],"exampleFix":"// before\nif (!response.ok) throw new ResponseError();\n// after\nif (!response.ok) {\n  const body = typia.assert<{ error?: string }>(await response.json().catch(() => ({})));\n  throw new ResponseError(body.error ?? \"Sorry, something went wrong. Please try again.\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isReportRequestFailure = (response: Response): boolean => !response.ok;","tryCatchPattern":"try {\n  const response = await request({ method: \"POST\", accept: \"json\", url: Routes.tax_form_transaction_report_path(doc.year) });\n  if (!response.ok) throw new ResponseError();\n  showAlert(\"You will receive an email shortly with your transaction report.\", \"success\");\n} catch (e) {\n  assertResponseError(e); // rethrow non-ResponseError (network/typia) so bugs don't become toasts\n  showAlert(\"Sorry, something went wrong. Please try again.\", \"error\");\n}","preventionTips":["Read the response body and surface its error, like sibling handlers in this codebase do.","Treat report requests as idempotent enqueues so user retries are safe.","Verify the year parameter is within the supported range before rendering the button."],"tags":["taxes","reports","http","settings"],"backgroundTag":"http-request-failed","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}