Skip to main content
REST-APIS5 MIN READ

Problem Details Without Leaking Internals

Design an RFC 9457 problem response that is useful to clients without exposing internals.

POST /subscriptions fails because the account already has an active subscription, but the endpoint currently returns a raw ORM duplicate constraint error. Classify the failure by caller action: valid request, conflicting resource state, stable public type, private correlation handle. Dumping the database exception feels transparent, but it couples clients to internals and may leak schema names or tenant information. Before 500 { "error": "SequelizeUniqueConstraintError: subscriptions_account_id_key" } After 409 application/problem+json with type /problems/subscription-already-active, title Subscription already active, detail Cancel or update the existing subscription before creating another, instance req_9b21, and active_subscription_id only if the caller is authorized to see it. Classify…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us