Exception.php
1.68 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* The Exception of the log serivce request & response.
*
* @author log service dev
*/
class Aliyun_Log_Exception extends Exception{
/**
* @var string
*/
private $requestId;
/**
* Aliyun_Log_Exception constructor
*
* @param string $code
* log service error code.
* @param string $message
* detailed information for the exception.
* @param string $requestId
* the request id of the response, '' is set if client error.
*/
public function __construct($code, $message, $requestId='') {
parent::__construct($message);
$this->code = $code;
$this->message = $message;
$this->requestId = $requestId;
}
/**
* The __toString() method allows a class to decide how it will react when
* it is treated like a string.
*
* @return string
*/
public function __toString() {
return "Aliyun_Log_Exception: \n{\n ErrorCode: $this->code,\n ErrorMessage: $this->message\n RequestId: $this->requestId\n}\n";
}
/**
* Get Aliyun_Log_Exception error code.
*
* @return string
*/
public function getErrorCode() {
return $this->code;
}
/**
* Get Aliyun_Log_Exception error message.
*
* @return string
*/
public function getErrorMessage() {
return $this->message;
}
/**
* Get log service sever requestid, '' is set if client or Http error.
*
* @return string
*/
public function getRequestId() {
return $this->requestId;
}
}