POST /subscriptions fails because the account already has an active subscription, but the endpoint returns a raw ORM duplicate constraint error. Translate private failure into public problem type, recovery detail, status, and correlation handle. Dumping the database exception feels transparent, but it couples clients to internal schema names, leaks implementation detail, and gives the caller no stable branch for recovery. Classify The request is syntactically valid but conflicts with current account state, so choose 409 Conflict. Status comes from the caller's recovery path, not from the exception class. Name type Create a stable problem type such as /problems/subscription-already-active. Clients should…
Read the full lesson
Sign up free: one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in