Error handling should fail predictably

What an application does when something goes wrong is a security decision.

Returning a stack trace hands out internals. Failing in a way that skips the check is worse. Differing responses for a wrong password and an unknown user leak which accounts exist. The rule is to fail closed, consistently, and say as little as the situation allows without making it impossible to debug.

More on Secure development