antiwork/gumroad · error · ResponseError
Something went wrong.
Error message
Something went wrong.
What it means
sendToKindle POSTs { email, file_external_id } to send_to_kindle_path. The server answers 200 with { success, error } and the throw fires when success is false, preferring the server's error string and falling back to 'Something went wrong.'. The catch uses assertResponseError, which re-throws anything that is not a ResponseError — so a TypiaError from the shape assert on a non-JSON/HTML response body would escape to the error boundary rather than the alert.
Source
Thrown at app/javascript/components/Download/FileList.tsx:812
token: string;
fileId: string;
email: null | string;
onDone: () => void;
}) => {
const [emailEntry, setEmailEntry] = React.useState<string>(email || "");
const [hasError, setHasError] = React.useState(false);
const sendToKindle = async () => {
try {
const response = await request({
url: Routes.send_to_kindle_path(token),
method: "POST",
accept: "json",
data: { email: emailEntry, file_external_id: fileId },
});
const json = typia.assert<{ success: boolean; error?: string }>(await response.json());
if (!json.success) throw new ResponseError(json.error ?? "Something went wrong.");
showAlert("It's been sent to your Kindle.", "success");
onDone();
} catch (e) {
assertResponseError(e);
showAlert(e.message, "error");
setHasError(true);
}
};
return (
<div>
<div className="flex gap-2">
<Fieldset className="flex-1" state={hasError ? "danger" : undefined}>
<Input
type="text"
value={emailEntry}
onChange={(evt) => {View on GitHub (pinned to afeacbd394)
Solutions
- Read the alert text — it is the server's own error message and usually names the exact problem (bad email, unsupported file, delivery failure).
- Validate the email format client-side before submitting (see defense).
- If the message is generic, check server logs for the Send-to-Kindle delivery attempt.
- Confirm the purchase token is still valid (same checks as any download action).
- For repeated delivery failures, suggest the user check their Amazon approved-sender list.
Example fix
// before
const json = typia.assert<{ success: boolean; error?: string }>(await response.json());
if (!json.success) throw new ResponseError(json.error ?? 'Something went wrong.');
// after — same behavior, but keep non-ResponseError shape failures inside the alert path too
let json: { success: boolean; error?: string };
try {
json = typia.assert<{ success: boolean; error?: string }>(await response.json());
} catch {
throw new ResponseError('Something went wrong.');
}
if (!json.success) throw new ResponseError(json.error ?? 'Something went wrong.'); Defensive patterns
Strategy: validation
Validate before calling
const KINDLE_EMAIL = /^[^\s@]+@[^\s@]+\.kindle\.com$/i; // or the country variants
if (!KINDLE_EMAIL.test(emailEntry.trim())) {
setHasError(true);
showAlert('Enter a valid Send-to-Kindle email address (e.g. you@kindle.com).', 'error');
return;
} Type guard
const isResponseError = (e: unknown): e is ResponseError => e instanceof ResponseError;
Try / catch
try {
await sendToKindle();
} catch (e) {
assertResponseError(e); // TypiaError escapes — keep the JSON parse inside a ResponseError wrapper
showAlert(e.message, 'error'); // usually the server's delivery-failure reason
} Prevention
- Validate the Kindle email format client-side before the POST — typos are the top cause.
- Show the server's error text verbatim; it names whether it was the address or the delivery.
- Wrap the typia assert so an HTML error page becomes a ResponseError instead of escaping via assertResponseError.
- Rate-limit the send button: repeated clicks both spam the endpoint and duplicate deliveries.
When it happens
Trigger: Invalid or undeliverable Kindle email (user typo, not an @kindle.com address); file type/size Amazon's conversion service rejects; purchase token expired; SMTP/delivery failure recorded server-side — all return success:false with an error message that becomes the alert text.
Common situations: Buyer typo in the Kindle email; sending a DRM'd or oversized file Amazon refuses; personal-document quota on the Kindle account exceeded; token expiry on old download pages.
Related errors
- ${responseData.error_message}
- ${responseData.message}
- Something went wrong.
- Something went wrong.
- Something went wrong.
AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21).
Data as JSON: /api/errors/0277ec4d4e3355a0.
Report an issue: GitHub.