-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException.php
More file actions
28 lines (24 loc) · 812 Bytes
/
Copy pathException.php
File metadata and controls
28 lines (24 loc) · 812 Bytes
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
<?php
include "exception/ValidationException.php";
include "data/LoginRequest.php";
include "helper/Validation.php";
$loginRequest = new LoginRequest();
$loginRequest->username = "reina";
$loginRequest->password = "";
try{
validateLoginRequest($loginRequest);
echo "Valid";
}catch(ValidationException $exception){
echo "Validation error : {$exception->getMessage()}".PHP_EOL;
}catch(Exception $exception){
echo "error : {$exception->getMessage()}".PHP_EOL;
var_dump($exception->getTrace());
echo "$exception->getTraceAsString()";
}finally{
echo "ERROR ATAU TIDAK, BLOCK INI AKAN TETAP DI EKSEKUSI".PHP_EOL;
}
/** Multiple Try Catch
* kalau mau misal pesan yang keluar sama maka bisa dihubungkan dengan tanta |
* contoh :
* catch(ValidationException | Exception $exception)
*/