# `PDOException` Class
+ The **`PDOException`** class represents an error raised by `PDO` when the error handling mode is set to **`PDO::ERRMODE_EXCEPTION`**
  + When a new `PDO` connection fails, it always throw a **`PDOException`** no matter what is the error handling mode
  + When a database operation causes an error, `PDO` throws a **`PDOException`**
  + Use `PHP` try and catch blocks to process the exception.
  + **`PDOException`** class provides these methods to identify the error:
    + **`getCode()`**: Returns the `SQLSTATE` 
    + **`getMessage()`**: Returns the error message
    + **`PDOException`** class does not provide the `MySQL` error code
  + You can get the error code from:
    + Database handle: **`PDO::errorInfo()`**
    + Statement handle: **`PDOStatement::errorInfo()`**
----------------------------------------------------------------------------------
`PDO::errorInfo()` and `PDOStatement::errorInfo()` fetch the error information associated with the last operation on the database handle and statement handle, respectively. The return value is an array containing the following elements:
- `SQLSTATE` error code
- `MySQL` error code
- Error message

If the last operation does not cause an error, the value of `SQLSTATE` element will be returned as `00000`.

This is an example of the values in the array:
```
Array ( [0] => 42000 [1] => 1064 [2] => You have an error in your SQL syntax ... )
```