I'm a backend developer that spends most of my time reading sci-fi and playing some games.
I strongly believe that one of the best ways to learn is to transmit knowledge, and that's why I'm here (:
You could return a message and not an error code. Another option is (in some cases) to change the user flow, redirecting the user to another page, and another option is to just log the error instead show to the user.
The problem with returning an error code is that the user won't know what the error means.
And raising an exception you'll break the application leaving the user frustrated.
I misunderstood your original article and thought you meant that we should not be returning error codes in our functions. I think it's ok to return error codes/throw exceptions in our functions but it should be caught (or we should detect the error code before it reaches the user) and display a friendly error message to the user.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You could return a message and not an error code. Another option is (in some cases) to change the user flow, redirecting the user to another page, and another option is to just log the error instead show to the user.
The problem with returning an error code is that the user won't know what the error means.
And raising an exception you'll break the application leaving the user frustrated.
Thanks!
I misunderstood your original article and thought you meant that we should not be returning error codes in our functions. I think it's ok to return error codes/throw exceptions in our functions but it should be caught (or we should detect the error code before it reaches the user) and display a friendly error message to the user.