try catch pdo code example
Example: php pdo error handling
$database -> errorInfo()[0] # SQLSTATE error code (a five characters alphanumeric identifier defined in the ANSI SQL standard).
$database -> errorInfo()[1] # Driver-specific error code.
$database -> errorInfo()[2] # Driver-specific error message.