Leaking too much info in user-facing error messages has historically been enough of a problem to get OWASP articles about it:
https://top10proactive.owasp.org/v3/en/c10-errors-exceptions
Well-run sites will have some kind of logging / exception-tracking behind the scenes that captures all the details about the error (stacktrace, request details, etc) for later review.