PHP Classes

File: examples/testcatch.php

Recommend this page to a friend!
  Classes of Jorge Castro  >  PHP PDO One  >  examples/testcatch.php  >  Download  
File: examples/testcatch.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP PDO One
Access to database with PDO and run common queries
Author: By
Last change: Update of examples/testcatch.php
Date: 1 year ago
Size: 321 bytes
 

Contents

Class file image Download
<?php

/**
 * @throws Exception
 */
function error1() {
    throw new
Exception("Error");
}

function
error2() {
   
trigger_error("some error",E_USER_ERROR);
}

try {
    @
error1();
} catch (
Exception $e) {
   
var_dump($e->getMessage());
}
try {
    @
error2();
} catch (
Exception $e) {
   
var_dump($e->getMessage());
}

For more information send a message to info at phpclasses dot org.