Welcome Guest, Not a member yet? Register   Sign In
Hide exceptions in production envairoment
#2

(This post was last modified: 05-20-2020, 08:34 AM by dave friend.)

Exceptions need to be handled. It's usually really bad practice not telling the user something failed. Exceptions cannot be ignored.

You need to give some thought as to why any given exception is happening. Ask yourself, "Is this problem something that could happen because of something the end-user does or is this happening because the developer has done something wrong?"

For instance, if when calling updateBatch() you don't supply the $index parameter you get an exception. That's a value that, most of the time, only the developer can provide to updateBatch().

You're going to find that a lot of exceptions are a wakeup call to the developer saying, "You have written bad code." I think the majority of exceptions are related to development issues.

For those few exceptions that are caused by coding mistakes, you must decide whether to write defensively - meaning code that leads the end-users where they need to be - or you need to implement try/catch blocks. Probably both.

In the catch block is where you either present the problem to the end-user or fix it for them.
Reply


Messages In This Thread
RE: Hide exceptions in production envairoment - by dave friend - 05-20-2020, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB