forked from ringcentral/pubnub-jtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPubnubException.java
More file actions
101 lines (88 loc) · 2.36 KB
/
Copy pathPubnubException.java
File metadata and controls
101 lines (88 loc) · 2.36 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.pubnub.api;
import org.json.JSONObject;
/**
* PubnubException is thrown by various Pubnub APIs
*
* @author PubnubCore
*/
public class PubnubException extends Exception {
private String errormsg = "";
private PubnubError pubnubError = PubnubError.PNERROBJ_PUBNUB_ERROR;
private JSONObject jso;
private String response;
/**
* Constructor for PubnubException Class with error message as argument
*
* @param s
* Error message
*/
public PubnubException(String s) {
this.errormsg = s;
}
/**
* Constructor for PubnubException Class with error message as argument
*
* @param pubnubError
* Error message
*/
public PubnubException(PubnubError pubnubError) {
this.pubnubError = pubnubError;
}
/**
* Constructor for PubnubException Class with error message as argument
*
* @param s
* Error message
*/
public PubnubException(PubnubError pubnubError, String s) {
this.errormsg = s;
this.pubnubError = pubnubError;
}
/**
* Constructor for PubnubException Class with error message as argument
*
* @param pubnubError
* @param s
* Error message
* @param response
* @param jso
*/
public PubnubException(PubnubError pubnubError, String s, String response, JSONObject jso) {
this.errormsg = s;
this.pubnubError = pubnubError;
this.jso = jso;
this.response = response;
}
/**
* Constructor for PubnubException Class with error message as argument
*
* @param pubnubError
* @param response
* @param jso
*/
public PubnubException(PubnubError pubnubError, String response, JSONObject jso) {
this.pubnubError = pubnubError;
this.jso = jso;
this.response = response;
}
/**
* Read the exception error message
*
* @return String
*/
public String toString() {
String msg = pubnubError.toString();
if (errormsg.length() > 0 )
msg = msg + " . " + errormsg;
return msg;
}
public PubnubError getPubnubError() {
return pubnubError;
}
public String getErrorResponse() {
return response;
}
public JSONObject getErrorJsonObject() {
return jso;
}
}