Show users a safe response

A production error page should explain that the request failed and what the user can do next. It should not display a stack trace, query, file path, token or internal host name.

Detailed errors can help an attacker map the application or find sensitive values. Keep those details in a controlled log instead of the browser response.

Keep useful logs for the team

Log a request identifier, time, affected service and error category. Limit access to logs and remove passwords, session tokens and unnecessary personal data.

Use a stable error code in the user response so support staff can connect it to a protected log entry. Restrict log retention to a defined business need.

Check the deployment settings

Disable development mode and verbose debug pages in production. Confirm that reverse proxies and application servers do not add internal details to error responses.

Review error handling after framework or hosting changes. Test common failure paths without exposing private records to a public user.