blob: ed714028cbe813d21ab8ef1baac65f7336f751c9 (
plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol;
/**
* <tt>OperationFailedException</tt> indicates an exception that occurred in the
* API.
* <p>
* <tt>OperationFailedException</tt> contains an error code that gives more
* information on the exception. The application can obtain the error code using
* {@link OperationFailedException#getErrorCode()}. The error code values are
* defined in the <tt>OperationFailedException</tt> fields.
* </p>
*
* @author Emil Ivov
*/
public class OperationFailedException
extends Exception
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
/**
* Set when no other error code can describe the exception that occurred.
*/
public static final int GENERAL_ERROR = 1;
/**
* Set when command fails due to a failure in network communications or
* a transport error.
*/
public static final int NETWORK_FAILURE = 2;
/**
* Set to indicate that a provider needs to be registered or signed on
* a public service before calling the method that threw the exception.
*/
public static final int PROVIDER_NOT_REGISTERED = 3;
/**
* Set when an operation fails for implementation specific reasons.
*/
public static final int INTERNAL_ERROR = 4;
/**
* Set when an operation fails for an error that has occurred on the server
* side.
*/
public static final int INTERNAL_SERVER_ERROR = 500;
/**
* Indicates that a user has tried to subscribe to a contact that already
* had an active subscription.
*/
public static final int SUBSCRIPTION_ALREADY_EXISTS = 5;
/**
* Indicates that a user has tried to create a group that already exist.
*/
public static final int CONTACT_GROUP_ALREADY_EXISTS = 6;
/**
* Indicates that a user has entered wrong account properties, like wrong
* port for example.
*/
public static final int INVALID_ACCOUNT_PROPERTIES = 7;
/**
* Indicates that authentication with a server has failed.
*/
public static final int AUTHENTICATION_FAILED = 401;
/**
* Indicates that the user is currently not allowed to perform the operation
* that failed.
*/
public static final int FORBIDDEN = 403;
/**
* Indicates that the user is trying to perform the current operation on a
* resource that does not exist.
*/
public static final int NOT_FOUND = 404;
/**
* Indicates that the user is trying to perform an operation with an
* identifier that was already in use on the target resource (e.g. log with
* a nickname that is already in use in a chat room, or create a chat room
* on a server that already contains a room with the same ID).
*/
public static final int IDENTIFICATION_CONFLICT = 10;
/**
* Indicates that the exception was thrown because a method has been
* passed an illegal or inappropriate argument.
*/
public static final int ILLEGAL_ARGUMENT = 11;
/**
* Indicates that the exception was thrown, because the user doesn't have
* enough privileges. Meant to be used by multi user chat to indicate that
* the user is trying to make an operation, which requires admin or owner
* privileges.
*/
public static final int NOT_ENOUGH_PRIVILEGES = 12;
/**
* Indicates that the user is required to be registered before performing
* the operation. This property is initially created to take care of chat
* room join error.
*/
public static final int REGISTRATION_REQUIRED = 13;
/**
* Indicates that we are currently not joined to the chat room, over which
* we try to perform an operation.
*/
public static final int CHAT_ROOM_NOT_JOINED = 14;
/**
* Indicates that the authentication process has been canceled.
*/
public static final int AUTHENTICATION_CANCELED = 15;
/**
* Indicates that the operation has been canceled by the user.
*/
public static final int OPERATION_CANCELED = 16;
/**
* Indicates that the operation has been canceled because of a missing
* server information.
*/
public static final int SERVER_NOT_SPECIFIED = 17;
/**
* The operation that throws this exception is not supported.
*/
public static final int NOT_SUPPORTED_OPERATION = 18;
/**
* The error code of the exception
*/
private final int errorCode;
/**
* Creates an exception with the specified error message and error code.
* @param message A message containing details on the error that caused the
* exception
* @param errorCode the error code of the exception (one of the error code
* fields of this class)
*/
public OperationFailedException(String message, int errorCode)
{
super(message);
this.errorCode = errorCode;
}
/**
* Creates an exception with the specified message, errorCode and cause.
* @param message A message containing details on the error that caused the
* exception
* @param errorCode the error code of the exception (one of the error code
* fields of this class)
* @param cause the error that caused this exception
*/
public OperationFailedException(String message,
int errorCode,
Throwable cause)
{
super(message, cause);
this.errorCode = errorCode;
}
/**
* Obtain the error code value.
*
* @return the error code for the exception.
*/
public int getErrorCode()
{
return errorCode;
}
}
|