-
Notifications
You must be signed in to change notification settings - Fork 1
/
usage.example1.php
67 lines (56 loc) · 2.2 KB
/
usage.example1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
// ----- Example 1a: Use try-catch in bootstrap to define controlled behaviour!
// Initialize Exception Handling
try {
// Your bootstrap code!
// Just some stupid code examples
$a = 1;
$a ++;
// Throw exception anywhere within the code...
throw new Exception("Dummy Exception 1a: Log only!");
} catch (Exception $e) {
// Handle exceptions using PHPCeption.
require_once 'PHPCeption/PHPCeption.php';
$phpceptionObj = PHPCeption_PHPCeption::createInstance();
require_once 'PHPCeption/Configurations/LogOnly.php';
$phpceptionObj->handle($e, PHPCeption_Configurations_LogOnly::createInstance());
}
// Notice: Code after catch will be executed!
// ===========================================================================
// ----- Example 1b: Use try-catch in bootstrap to define controlled behaviour!
// Initialize Exception Handling
try {
// Your bootstrap code!
// Just some stupid code examples
$a = 1;
$a ++;
// Throw exception anywhere within the code...
throw new Exception("Dummy Exception 1b: NoDisplay (Log+Notify only!)");
} catch (Exception $e) {
// Handle exceptions using PHPCeption.
require_once 'PHPCeption/PHPCeption.php';
$phpceptionObj = PHPCeption_PHPCeption::createInstance();
require_once 'PHPCeption/Configurations/NoDisplay.php';
$phpceptionObj->handle($e, PHPCeption_Configurations_NoDisplay::createInstance());
}
// Notice: Code after catch will be executed!
// ===========================================================================
// ----- Example 1c: Use try-catch in bootstrap to define controlled behaviour!
// Initialize Exception Handling
try {
// Your bootstrap code!
// Just some stupid code examples
$a = 1;
$a ++;
// Throw exception anywhere within the code...
throw new Exception("Dummy Exception 1c: Display and exit manually!");
} catch (Exception $e) {
// Handle exceptions using PHPCeption.
require_once 'PHPCeption/PHPCeption.php';
$phpceptionObj = PHPCeption_PHPCeption::createInstance();
require_once 'PHPCeption/Configurations/NoDisplay.php';
$phpceptionObj->handle($e);
exit();
}
// Notice: Code after catch will NOT be executed because of manual exit!
echo 'Example text 1c...';