antiwork/gumroad · error · ResponseError

Something went wrong.

Error message

Something went wrong.

What it means

Save failure in the Australian back-tax collection opt-in modal. save() POSTs { signature } to opt_in_to_au_backtax_collection_settings_payments_path; a non-2xx throws bare `new ResponseError()`, whose default message from utils/request.ts is 'Something went wrong.'. A 2xx with success:false instead throws ResponseError(optInResponse.error) with the server's own text. assertResponseError in the catch rethrows anything that isn't a ResponseError (e.g. a typia contract violation), so this path is strictly for HTTP-level or refused-opt-in failures.

Source

Thrown at app/javascript/components/server-components/TaxesCollectionModal.tsx:40

};

export const TaxesCollectionModal = ({ taxesOwed, creditCreationDate, name }: Props) => {
  const uid = React.useId();
  const [signature, setSignature] = React.useState("");
  const [optingIn, setOptingIn] = React.useState(false);
  const [saving, setSaving] = React.useState(false);
  const [error, setError] = React.useState("");

  const save = async () => {
    setSaving(true);
    try {
      const response = await request({
        method: "POST",
        url: Routes.opt_in_to_au_backtax_collection_settings_payments_path(),
        accept: "json",
        data: { signature },
      });
      if (!response.ok) throw new ResponseError();
      const optInResponse: SaveOptInResponse = typia.assert<SaveOptInResponse>(await response.json());
      if (optInResponse.success) return window.location.reload();
      throw new ResponseError(optInResponse.error);
    } catch (e) {
      assertResponseError(e);
      setError(e.message);
    }
    setSaving(false);
  };

  return (
    <div>
      <Button color="accent" onClick={() => setOptingIn(true)}>
        Opt-in to backtaxes collection
      </Button>
      {optingIn ? (
        <Modal
          open

View on GitHub (pinned to afeacbd394)

Solutions

  1. Reload the payments page and reopen the modal so the signature payload is regenerated.
  2. Note that a server-provided message would be shown verbatim — this generic one only appears for non-2xx responses.
  3. Check the POST in devtools: 401/redirect means session; 422 usually means signature mismatch.
  4. Backend: return { error: '...' } on failure paths so users see specifics.
Defensive patterns

Strategy: try-catch

Type guard

const isOptInRefused = (body: SaveOptInResponse): boolean => body.success === false;

Try / catch

try {
  const response = await request({ method: "POST", url: Routes.opt_in_to_au_backtax_collection_settings_payments_path(), accept: "json", data: { signature } });
  if (!response.ok) throw new ResponseError();
  const optInResponse = typia.assert<SaveOptInResponse>(await response.json());
  if (optInResponse.success) return window.location.reload();
  throw new ResponseError(optInResponse.error);
} catch (e) {
  assertResponseError(e); // rethrow typia/network bugs — only expected failures become UI text
  setError(e.message);
}

Prevention

When it happens

Trigger: POST returns 401/419/422/500 (expired session, invalid or missing signature, server-side rejection of the opt-in record) with any body; or success:false with an error string surfaced to the user.

Common situations: Signature data not rendered into the modal (server-component props drift), double-submit after the button re-enables, session expiry on a long-open payments page, or backend validation failing while returning no error field.

Related errors


AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21). Data as JSON: /api/errors/3869dea6d4b02ac9. Report an issue: GitHub.