/
ServerErrors.ice
368 lines (315 loc) · 10.7 KB
/
ServerErrors.ice
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*
* $Id$
*
* Copyright 2007 Glencoe Software, Inc. All rights reserved.
* Use is subject to license terms supplied in LICENSE.txt
*
*/
#ifndef OMERO_SERVERERRORS_ICE
#define OMERO_SERVERERRORS_ICE
#include <Glacier2/Session.ice>
#include <omero/Collections.ice>
/**
* Exceptions thrown by OMERO server components. Exceptions thrown client side
* are available defined in each language binding separately, but will usually
* subclass from "ClientError" For more information, see:
*
* <a href="https://trac.openmicroscopy.org.uk/ome/wiki/ExceptionHandling">
* https://trac.openmicroscopy.org.uk/ome/wiki/ExceptionHandling
* </a>
*
* including examples of what a appropriate try/catch block would look like.
*
* <p>
* All exceptions that are thrown by a remote call (any call on a *Prx instance)
* will be either a subclass of {@link Ice.UserException} or {@link Ice.LocalException}.
* <a href="http://doc.zeroc.com/display/Ice/Run-Time+Exceptions#Run-TimeExceptions-InheritanceHierarchyforExceptions">Inheritance Hierarchy for Exceptions</a>
* from the Ice manual shows the entire exception hierarchy. The exceptions described in
* this file will subclass from {@link Ice.UserException}. Other Ice-runtime exceptions subclass
* from {@link Ice.LocalException}.
* </p>
*
* <pre>
*
* OMERO Specific:
* ===============
* ServerError (root server exception)
* |
* |_ InternalException (server bug)
* |
* |_ ResourceError (non-recoverable)
* | \_ NoProcessorAvailable
* |
* |_ ConcurrencyException (recoverable)
* | |_ ConcurrentModification (data was changed)
* | |_ OptimisticLockException (changed data conflicts)
* | |_ LockTimeout (took too long to aquire lock)
* | |_ TryAgain (some processing required before server is ready)
* | \_ TooManyUsersException
* | \_ DatabaseBusyException
* |
* |_ ApiUsageException (misuse of services)
* | |_ OverUsageException (too much)
* | |_ QueryException (bad query string)
* | |_ ValidationException (bad data)
* | |_ ChecksumValidationException (checksum mismatch)
* | \_ FilePathNamingException (repository path badly named)
* |
* |_ SecurityViolation (some no-no)
* | \_ GroupSecurityViolation
* | |_ PermissionMismatchGroupSecurityViolation
* | \_ ReadOnlyGroupSecurityViolation
* |
* \_SessionException
* |_ RemovedSessionException (accessing a non-extant session)
* |_ SessionTimeoutException (session timed out; not yet removed)
* \_ ShutdownInProgress (session on this server will most likely be destroyed)
* </pre>
*
*
* <p>
* However, in addition to {@link Ice.LocalException} subclasses, the Ice runtime also
* defines subclasses of {@link Ice.UserException}. In some cases, OMERO subclasses
* from these exceptions. The subclasses shown below are not exhaustive, but show those
* which an application's exception handler may want to deal with.
* </p>
*
*
* <pre>
* Ice::Exception (root of all Ice exceptions)
* |
* |_ Ice::UserException (super class of all application exceptions)
* | |
* | |_ Glacier2::CannotCreateSessionException (1 of 2 exceptions throwable by createSession)
* | | |_ omero::AuthenticationException (bad login)
* | | |_ omero::ExpiredCredentialException (old password)
* | | |_ omero::WrappedCreateSessionException (any other server error during createSession)
* | | \_ omero::licenses::NoAvailableLicensesException (see tools/licenses/resources/omero/LicensesAPI.ice)
* | |
* | \_ Glacier2::PermissionDeniedException (other of 2 exceptions throwable by createSession)
* |
* \_ Ice::LocalException (should generally be considered fatal. See exceptions below)
* |
* |_ Ice::ProtocolException (something went wrong on the wire. Wrong version?)
* |
* |_ Ice::RequestFailedException
* | |_ ObjectNotExistException (Service timeout or similar?)
* | \_ OperationNotExistException (Improper use of uncheckedCast?)
* |
* |_ Ice::UnknownException (server threw an unexpected exception. Bug!)
* |
* \_ Ice::TimeoutException
* \_ Ice::ConnectTimeoutException (Couldn't establish a connection. Retry?)
*
* </pre>
*
**/
module omero
{
/*
* Base exception. Equivalent to the ome.conditions.RootException.
* RootException must be split into a ServerError and a ClientError
* base-class since the two systems are more strictly split by the
* Ice-runtime than is done in RMI/Java.
*/
exception ServerError
{
string serverStackTrace;
string serverExceptionClass;
string message;
};
// SESSION EXCEPTIONS --------------------------------
/**
* Base session exception, though in the OMERO.blitz
* implementation, all exceptions thrown by the Glacier2
* must subclass CannotCreateSessionException. See below.
*/
exception SessionException extends ServerError
{
};
/**
* Session has been removed. Either it was closed, or it
* timed out and one "SessionTimeoutException" has already
* been thrown.
*/
exception RemovedSessionException extends SessionException
{
};
/**
* Session has timed out and will be removed.
*/
exception SessionTimeoutException extends SessionException
{
};
/**
* Server is in the progress of shutting down which will
* typically lead to the current session being closed.
*/
exception ShutdownInProgress extends SessionException
{
};
// SESSION EXCEPTIONS (Glacier2) ---------------------
/**
* createSession() is a two-phase process. First, a PermissionsVerifier is
* called which must return true; then a SessionManager is called to create
* the session (ServiceFactory). If the PermissionsVerifier returns false,
* then PermissionDeniedException will be thrown. This, however, cannot be
* subclassed and so string parsing must be used.
*/
/**
* Thrown when the information provided omero.createSession() or more
* specifically Glacier2.RouterPrx.createSession() is incorrect. This
* does -not- subclass from the omero.ServerError class because the
* Ice Glacier2::SessionManager interface can only throw CCSEs.
*/
exception AuthenticationException extends Glacier2::CannotCreateSessionException
{
};
/**
* Thrown when the password for a user has expried. Use: ISession.changeExpiredCredentials()
* and login as guest. This does -not- subclass from the omero.ServerError class because the
* Ice Glacier2::SessionManager interface can only throw CCSEs.
*/
exception ExpiredCredentialException extends Glacier2::CannotCreateSessionException
{
};
/**
* Thrown when any other server exception causes the session creation to fail.
* Since working with the static information of Ice exceptions is not as easy
* as with classes, here we use booleans to represent what has gone wrong.
*/
exception WrappedCreateSessionException extends Glacier2::CannotCreateSessionException
{
bool concurrency;
long backOff; /* Only used if ConcurrencyException */
string type; /* Ice static type information */
};
// OTHER SERVER EXCEPTIONS ------------------------------
/**
* Programmer error. Ideally should not be thrown.
*/
exception InternalException extends ServerError
{
};
// RESOURCE
/**
* Unrecoverable error. The resource being accessed is not available.
*/
exception ResourceError extends ServerError
{
};
/**
* A script cannot be executed because no matching processor
* was found.
*/
exception NoProcessorAvailable extends ResourceError
{
/**
* Number of processors that responded to the inquiry.
* If 1 or more, then the given script was not acceptable
* (e.g. non-official) and a specialized processor may need
* to be started.
**/
int processorCount;
};
// CONCURRENCY
/**
* Recoverable error caused by simultaneous access of some form.
*/
exception ConcurrencyException extends ServerError
{
long backOff; /* Backoff in milliseconds */
};
/**
* Currently unused.
*/
exception ConcurrentModification extends ConcurrencyException
{
};
/**
* Too many simultaneous database users. This implies that a
* connection to the database could not be acquired, no data
* was saved or modifed. Clients may want to wait the given
* backOff period, and retry.
*/
exception DatabaseBusyException extends ConcurrencyException
{
};
/**
* Conflicting changes to the same piece of data.
*/
exception OptimisticLockException extends ConcurrencyException
{
};
/**
* Lock cannot be acquired and has timed out.
*/
exception LockTimeout extends ConcurrencyException
{
int seconds; /* Informational field on how long timeout was */
};
/**
* Background processing needed before server is ready
*/
exception TryAgain extends ConcurrencyException
{
};
exception MissingPyramidException extends ConcurrencyException
{
long pixelsID;
};
// API USAGE
exception ApiUsageException extends ServerError
{
};
exception OverUsageException extends ApiUsageException
{
};
exception QueryException extends ApiUsageException
{
};
exception ValidationException extends ApiUsageException
{
};
exception ChecksumValidationException extends ValidationException
{
omero::api::IntStringMap failingChecksums;
};
exception FilePathNamingException extends ValidationException
{
/* the file path that breaks the server's rules */
string illegalFilePath;
/* the rules actually violated by the file path */
omero::api::IntegerList illegalCodePoints; /* proscribed Unicode code points */
omero::api::StringSet illegalPrefixes; /* proscribed name prefixes */
omero::api::StringSet illegalSuffixes; /* proscribed name suffixes */
omero::api::StringSet illegalNames; /* proscribed names */
};
// SECURITY
exception SecurityViolation extends ServerError
{
};
exception GroupSecurityViolation extends SecurityViolation
{
};
exception PermissionMismatchGroupSecurityViolation extends SecurityViolation
{
};
exception ReadOnlyGroupSecurityViolation extends SecurityViolation
{
};
// OMEROFS
/**
* OmeroFSError
*
* Just one catch-all UserException for the present. It could be
* subclassed to provide a finer grained level if necessary.
*
* It should be fitted into or subsumed within the above hierarchy
**/
exception OmeroFSError extends ServerError
{
string reason;
};
};
#endif // OMERO_SERVERERRORS_ICE