Table of Contents
valentina_throw_exceptions()
VPHP Version
3.6 and later
Declaration
bool valentina_throw_exceptions ( [bool mode] )
Parameters
Name | Description | |
---|---|---|
mode | true - enable throwing an exceptions, false - disable it. |
Description
If called without argument - return current mode.
Return Values
Returns the current mode if no argument passed.
Examples
Example 1.
<?php valentina_throw_exceptions( true ); $link = valentina_connect('localhost', 'val_user', 'val_password'); try { valentina_connect("localhost", "val_user", "val_password"); valentina_select_db( "test_database" ) valentina_query( "SELECT * FROM T10" ); }catch( Exception $e ) { print( "Error In File:" . $e->getFile() . "<BR>" ); print( "Error In Line:" . $e->getLine() . "<BR>" ); print( "Error message:" . $e->getMessage() . "<BR>" ); print( "Error code:" . $e->getCode() . "<BR>" ); } ?>
If table “T10” is not present on the VServer then the above example will output something similar to:
Error In File:VPHP\Examples\exception_handling.php Error In Line:9 Error message:Table "T10" not found. Error code:460035
Notes
Exception mode can be also set in the php.ini file:
[valentina] valentina.throw_exceptions = On