fix: surface real create-job failure reason instead of generic error
All checks were successful
build-and-release / build (push) Successful in 1m35s

Backend now returns JSON error bodies with a code field for every
create_job failure branch. Special-case QUOTA_EXHAUSTED with an
actionable message since there's no self-serve job-slot purchase flow
yet (support has to grant slots manually).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Ashwin Kumar Sivakumar 2026-08-03 17:04:43 +05:30
parent 65bdefadc7
commit 9f1448ee1e

View file

@ -284,7 +284,11 @@ export default function CompanyJobsPage() {
}); });
const data = await res.json().catch(() => ({})); const data = await res.json().catch(() => ({}));
if (!res.ok) { if (!res.ok) {
setError(data.error ?? data.message ?? "Failed to create job."); if (data.code === "QUOTA_EXHAUSTED") {
setError("You've used your free job post for this month. Contact support to purchase additional job slots.");
} else {
setError(data.error ?? data.message ?? "Failed to create job.");
}
return; return;
} }
setActionMsg("Job created as draft."); setActionMsg("Job created as draft.");