News for hackers. Stuff that matters.
Re:Away from Exceptions: Errors as Values by tored on Tuesday August 31, 2021 @01:28PM (#28370926)
Throw an exception.

In PHP we would throw LogicException on these cases, it should never happen thus it something wrong with your code (logic).

https://www.php.net/manual/en/class.logicexception.php

Then in your outmost function , like the main function, you capture it and report it with a error reporting tool like Sentry (so you are aware of it and can fix it).

And for the end user you would show a modal or similar to describe the error in user friendly way.

There are no comments on this comment yet.