forked from domingopa/WhatsAPI-Official
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception.php
More file actions
executable file
·51 lines (39 loc) · 1.66 KB
/
Copy pathexception.php
File metadata and controls
executable file
·51 lines (39 loc) · 1.66 KB
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
<?php
interface IException
{
/* Protected methods inherited from Exception class */
public function getMessage(); // Exception message
public function getCode(); // User-defined Exception code
public function getFile(); // Source filename
public function getLine(); // Source line
public function getTrace(); // An array of the backtrace()
public function getTraceAsString(); // Formated string of trace
/* Overrideable methods inherited from Exception class */
public function __toString(); // formated string for display
public function __construct($message = null, $code = 0);
}
abstract class CustomException extends Exception implements IException
{
protected $message = 'Unknown exception'; // Exception message
protected $code = 0; // User-defined exception code
protected $file; // Source filename of exception
protected $line; // Source line of exception
public function __construct($message = null, $code = 0)
{
if ( ! $message) {
throw new $this('Unknown ' . get_class($this));
}
parent::__construct($message, $code);
}
public function __toString()
{
return get_class($this) . " '{$this->message}' in {$this->file}({$this->line})\n"
. "{$this->getTraceAsString()}";
}
}
/*
* Exception occurs when we have no active socket
* connection to whatsapp
*/
class ConnectionException extends Exception{}
class LoginFailureException extends Exception{}