mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-17 19:16:20 +02:00
Reworded Error Control Operator and ErrorExceptions
Signed-off-by: Aran Wilkinson <aran3001@gmail.com>
This commit is contained in:
@@ -31,17 +31,21 @@ out the [Error Reporting][errorreport].
|
||||
|
||||
As well as setting the level of error reporting during script execution you can also suppress Errors using the
|
||||
Error Control Operator `@` by putting this operator at the beginning an expression. The use of this operator
|
||||
is not advised
|
||||
is not advised and should never be used, using this operator is like admitting your code is bad and can fail over
|
||||
|
||||
* [Error Control Operators](http://php.net/manual/en/language.operators.errorcontrol.php)
|
||||
|
||||
### Error Exceptions
|
||||
|
||||
Optionally you can throw your Errors as Exceptions using the `ErrorException` class, this extends the `Exception`
|
||||
class. More information on this and details on how to use `ErrorException` can be found at
|
||||
[ErrorException Class][errorexception]. This is a common practice but it is not an advised practice.
|
||||
Errors are used to faults and potential issues in your code that should be corrected.
|
||||
Optionally you can throw your Errors as Exceptions using the `ErrorException` class, this class extends the `Exception`
|
||||
class. This is a common practice and by passing errors off as Exceptions in development you can handle them better than
|
||||
the usual result. By passing these Errors as Exceptions and not trying to catch them in Development the hope is that
|
||||
you'll catch the Error and hopefully this will allow you to deal with the issue before it becomes a problem in a
|
||||
Production Environment.
|
||||
More information on this and details on how to use `ErrorException` with Error Handling can be found at
|
||||
[ErrorException Class][errorexception].
|
||||
|
||||
* [Error Control Operators](http://php.net/manual/en/language.operators.errorcontrol.php)
|
||||
* [Predefined Constants for Error Handling](http://www.php.net/manual/en/errorfunc.constants.php)
|
||||
* [error_reporting](http://www.php.net/manual/en/function.error-reporting.php)
|
||||
* [ErrorException Class][errorexception]
|
||||
|
Reference in New Issue
Block a user