Pdo Exception (Mysql) does not detect custom errors

0

I'm doing maintenance in PHP (PDO) to a table using a Store Procedure (Mysql) in a certain situation I throw an exception from Mysql in the following way:

SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='Cheque cobrado, no se puede anular.';

in PHP I execute the sentence in this way:

try {
    ....................
    ....................
    ....................       
    $stmt->execute();
    } 
    catch (PDOException $e) {
        echo "Error en la Ejecucion: ".$e->getMessage();
    }

It should be noted that the connection with the PDO :: ATTR_ERRMODE-> attribute has been set. PDO :: ERRMODE_EXCEPTION and I capture the usual MYSQL errors but with the custom errors I have not had any luck.

I have already tried console and from VB.net and the procedure if it returns the error message.

    
asked by Emersoft 30.10.2017 в 22:53
source

0 answers