Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: say why a person's job tab failed to load

aashu88814674435d
diff --git a/apps/erp/app/routes/x+/person+/$personId.job.tsx b/apps/erp/app/routes/x+/person+/$personId.job.tsx
index 901c2ffb89..98e5406fe3 100644
--- a/apps/erp/app/routes/x+/person+/$personId.job.tsx
+++ b/apps/erp/app/routes/x+/person+/$personId.job.tsx
@@ -26,9 +26,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const job = await getEmployeeJob(client, personId, companyId);
if (job.error) {
+ // PGRST116 = no rows: the person has no job record in this company.
+ const message =
+ job.error.code === "PGRST116"
+ ? "This person has no job record in this company"
+ : `Failed to load job: ${job.error.message}`;
throw redirect(
path.to.people,
- await flash(request, error(job.error, "Failed to load job"))
+ await flash(request, error(job.error, message))
);
}