Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
LocalExceptions.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICE_LOCAL_EXCEPTIONS_H
4#define ICE_LOCAL_EXCEPTIONS_H
5
6#include "Ice/Identity.h"
7#include "Ice/ReplyStatus.h"
8#include "LocalException.h"
9
10#include <memory>
11#include <optional>
12#include <string>
13#include <string_view>
14#include <utility>
15
16// This file contains most exceptions derived from Ice::LocalException.
17
18namespace Ice
19{
20 class ObjectPrx;
21
22 //
23 // Dispatch exceptions
24 //
25
26 /// The exception that is thrown when a dispatch failed. This is the base class for local exceptions that can be
27 /// marshaled and transmitted "over the wire".
28 /// You can throw this exception in the implementation of an operation, or in a middleware. The Ice runtime then
29 /// logically rethrows this exception to the client.
30 /// @headerfile Ice/Ice.h
31 class ICE_API DispatchException : public LocalException
32 {
33 public:
34 /// Constructs a DispatchException.
35 /// @param file The file where this exception is constructed. This C string is not copied.
36 /// @param line The line where this exception is constructed.
37 /// @param replyStatus The reply status. It must be greater than ReplyStatus::UserException.
38 /// @param message The error message. If nullopt, this constructor creates a default message.
40 const char* file,
41 int line,
43 std::optional<std::string> message = std::nullopt);
44
45 /// Gets the reply status.
46 /// @return The reply status.
47 [[nodiscard]] ReplyStatus replyStatus() const noexcept { return _replyStatus; }
48
49 [[nodiscard]] const char* ice_id() const noexcept override;
50
51 private:
52 ReplyStatus _replyStatus;
53 };
54
55 /// The base class for the 3 NotExist exceptions.
56 /// @headerfile Ice/Ice.h
58 {
59 public:
60 /// The identity of the Ice Object to which the request was sent.
61 [[nodiscard]] const Identity& id() const noexcept { return *_id; }
62
63 /// The facet to which the request was sent.
64 [[nodiscard]] const std::string& facet() const noexcept { return *_facet; }
65
66 /// The operation name of the request.
67 [[nodiscard]] const std::string& operation() const noexcept { return *_operation; }
68
69 protected:
70 /// @cond INTERNAL
71 /// Constructs a RequestFailedException with a custom error message.
72 /// @param file The file where this exception is constructed. This C string is not copied.
73 /// @param line The line where this exception is constructed.
74 /// @param replyStatus The reply status.
75 /// @param id The identity of the Ice Object to which the request was sent.
76 /// @param facet The facet to which the request was sent.
77 /// @param operation The operation name of the request.
79 const char* file,
80 int line,
81 ReplyStatus replyStatus,
82 Identity id,
83 std::string facet,
84 std::string operation);
85
86 /// Constructs a RequestFailedException without specifying the details of the current request. The details will
87 /// be filled-in automatically by the Ice runtime before marshaling the exception.
88 /// @param file The file where this exception is constructed. This C string is not copied.
89 /// @param line The line where this exception is constructed.
90 /// @param replyStatus The reply status.
91 RequestFailedException(const char* file, int line, ReplyStatus replyStatus);
92
93 RequestFailedException(const RequestFailedException&) noexcept = default;
94 RequestFailedException& operator=(const RequestFailedException&) noexcept = default;
95 ~RequestFailedException() override; // to avoid weak vtable
96 /// @endcond
97
98 private:
99 std::shared_ptr<Identity> _id;
100 std::shared_ptr<std::string> _facet;
101 std::shared_ptr<std::string> _operation;
102 };
103
104 /// The exception that is thrown when a dispatch cannot find a servant for the identity carried by the request.
105 /// @headerfile Ice/Ice.h
107 {
108 public:
109 /// Constructs an ObjectNotExistException.
110 /// @param file The file where this exception is constructed. This C string is not copied.
111 /// @param line The line where this exception is constructed.
112 /// @param id The identity of the Ice Object to which the request was sent.
113 /// @param facet The facet to which the request was sent.
114 /// @param operation The operation name of the request.
115 ObjectNotExistException(const char* file, int line, Identity id, std::string facet, std::string operation);
116
117 /// Constructs an ObjectNotExistException without specifying the details of the current request. The details
118 /// will be filled-in automatically by the Ice runtime before marshaling the exception.
119 /// @param file The file where this exception is constructed. This C string is not copied.
120 /// @param line The line where this exception is constructed.
121 ObjectNotExistException(const char* file, int line);
122
123 [[nodiscard]] const char* ice_id() const noexcept final;
124 };
125
126 /// The exception that is thrown when a dispatch cannot find a servant for the identity + facet carried by the
127 /// request.
128 /// @headerfile Ice/Ice.h
130 {
131 public:
132 /// Constructs a FacetNotExistException.
133 /// @param file The file where this exception is constructed. This C string is not copied.
134 /// @param line The line where this exception is constructed.
135 /// @param id The identity of the Ice Object to which the request was sent.
136 /// @param facet The facet to which the request was sent.
137 /// @param operation The operation name of the request.
138 FacetNotExistException(const char* file, int line, Identity id, std::string facet, std::string operation);
139
140 /// Constructs a FacetNotExistException without specifying the details of the current request. The details will
141 /// be filled-in automatically by the Ice runtime before marshaling the exception.
142 /// @param file The file where this exception is constructed. This C string is not copied.
143 /// @param line The line where this exception is constructed.
144 FacetNotExistException(const char* file, int line);
145
146 [[nodiscard]] const char* ice_id() const noexcept final;
147 };
148
149 /// The exception that is thrown when a dispatch cannot find the operation carried by the request on the target
150 /// servant. This is typically due to a mismatch in the Slice definitions, such as the client using Slice
151 /// definitions newer than the server's.
152 /// @headerfile Ice/Ice.h
154 {
155 public:
156 /// Constructs an OperationNotExistException.
157 /// @param file The file where this exception is constructed. This C string is not copied.
158 /// @param line The line where this exception is constructed.
159 /// @param id The identity of the Ice Object to which the request was sent.
160 /// @param facet The facet to which the request was sent.
161 /// @param operation The operation name of the request.
162 OperationNotExistException(const char* file, int line, Identity id, std::string facet, std::string operation);
163
164 /// Constructs an OperationNotExistException without specifying the details of the current request. The details
165 /// will be filled-in automatically by the Ice runtime before marshaling the exception.
166 /// @param file The file where this exception is constructed. This C string is not copied.
167 /// @param line The line where this exception is constructed.
168 OperationNotExistException(const char* file, int line);
169
170 [[nodiscard]] const char* ice_id() const noexcept final;
171 };
172
173 /// The exception that is thrown when a dispatch failed with an exception that is not a LocalException or a
174 /// UserException.
175 /// @headerfile Ice/Ice.h
176 class ICE_API UnknownException : public DispatchException
177 {
178 public:
179 /// Constructs an UnknownException.
180 /// @param file The file where this exception is constructed. This C string is not copied.
181 /// @param line The line where this exception is constructed.
182 /// @param message The error message adopted by this exception and returned by what().
183 UnknownException(const char* file, int line, std::string message);
184
185 [[nodiscard]] const char* ice_id() const noexcept override;
186
187 protected:
188 /// Constructs an UnknownException.
189 /// @param file The file where this exception is constructed. This C string is not copied.
190 /// @param line The line where this exception is constructed.
191 /// @param replyStatus The reply status.
192 /// @param message The error message adopted by this exception and returned by what().
193 UnknownException(const char* file, int line, ReplyStatus replyStatus, std::string message);
194 };
195
196 /// The exception that is thrown when a dispatch failed with a LocalException that is not a DispatchException.
197 /// @headerfile Ice/Ice.h
198 class ICE_API UnknownLocalException final : public UnknownException
199 {
200 public:
201 /// Constructs an UnknownLocalException.
202 /// @param file The file where this exception is constructed. This C string is not copied.
203 /// @param line The line where this exception is constructed.
204 /// @param message The error message adopted by this exception and returned by what().
205 UnknownLocalException(const char* file, int line, std::string message);
206
207 [[nodiscard]] const char* ice_id() const noexcept final;
208 };
209
210 /// The exception that is thrown when a client receives a UserException that was not declared in the operation's
211 /// exception specification.
212 /// @headerfile Ice/Ice.h
213 class ICE_API UnknownUserException final : public UnknownException
214 {
215 public:
216 /// Constructs an UnknownUserException.
217 /// @param file The file where this exception is constructed. This C string is not copied.
218 /// @param line The line where this exception is constructed.
219 /// @param message The error message adopted by this exception and returned by what().
220 UnknownUserException(const char* file, int line, std::string message);
221
222 /// Creates an UnknownUserException from the type ID of an unexpected exception.
223 /// @param file The file where this exception is constructed. This C string is not copied.
224 /// @param line The line where this exception is constructed.
225 /// @param typeId The type ID.
226 static UnknownUserException fromTypeId(const char* file, int line, const char* typeId);
227
228 [[nodiscard]] const char* ice_id() const noexcept final;
229 };
230
231 //
232 // Protocol exceptions
233 //
234
235 /// The base class for exceptions related to the Ice protocol.
236 /// @headerfile Ice/Ice.h
237 class ICE_API ProtocolException : public LocalException
238 {
239 public:
241
242 [[nodiscard]] const char* ice_id() const noexcept override;
243 };
244
245 /// The exception that is thrown when the connection has been gracefully shut down by the server. The request
246 /// that returned this exception has not been executed by the server. In most cases you will not get this exception,
247 /// because the client will automatically retry the invocation. However, if upon retry the server shuts down the
248 /// connection again, and the retry limit has been reached, then this exception is propagated to the application
249 /// code.
250 /// @headerfile Ice/Ice.h
251 class ICE_API CloseConnectionException final : public ProtocolException
252 {
253 public:
254 /// Constructs a CloseConnectionException.
255 /// @param file The file where this exception is constructed. This C string is not copied.
256 /// @param line The line where this exception is constructed.
257 CloseConnectionException(const char* file, int line)
258 : ProtocolException(file, line, "connection closed by the peer")
259 {
260 }
261
262 [[nodiscard]] const char* ice_id() const noexcept final;
263 };
264
265 /// The exception that is thrown when a datagram exceeds the configured send or receive buffer size, or exceeds the
266 /// maximum payload size of a UDP packet (65507 bytes).
267 /// @headerfile Ice/Ice.h
268 class ICE_API DatagramLimitException final : public ProtocolException
269 {
270 public:
271 /// Constructs a DatagramLimitException.
272 /// @param file The file where this exception is constructed. This C string is not copied.
273 /// @param line The line where this exception is constructed.
274 DatagramLimitException(const char* file, int line)
275 : ProtocolException(file, line, "datagram size exceeds configured limit")
276 {
277 }
278
279 [[nodiscard]] const char* ice_id() const noexcept final;
280 };
281
282 /// The exception that is thrown when an error occurs during marshaling or unmarshaling.
283 /// @headerfile Ice/Ice.h
284 class ICE_API MarshalException final : public ProtocolException
285 {
286 public:
287 using ProtocolException::ProtocolException;
288
289 [[nodiscard]] const char* ice_id() const noexcept final;
290 };
291
292 //
293 // Timeout exceptions
294 //
295
296 /// The exception that is thrown when a timeout occurs. This is the base class for all timeout exceptions.
297 /// @headerfile Ice/Ice.h
298 class ICE_API TimeoutException : public LocalException
299 {
300 public:
302
303 [[nodiscard]] const char* ice_id() const noexcept override;
304 };
305
306 /// The exception that is thrown when a connection establishment times out.
307 /// @headerfile Ice/Ice.h
308 class ICE_API ConnectTimeoutException final : public TimeoutException
309 {
310 public:
311 /// Constructs a ConnectTimeoutException.
312 /// @param file The file where this exception is constructed. This C string is not copied.
313 /// @param line The line where this exception is constructed.
314 ConnectTimeoutException(const char* file, int line)
315 : TimeoutException(file, line, "connection establishment timed out")
316 {
317 }
318
319 [[nodiscard]] const char* ice_id() const noexcept final;
320 };
321
322 /// The exception that is thrown when a graceful connection closure times out.
323 /// @headerfile Ice/Ice.h
324 class ICE_API CloseTimeoutException final : public TimeoutException
325 {
326 public:
327 /// Constructs a CloseTimeoutException.
328 /// @param file The file where this exception is constructed. This C string is not copied.
329 /// @param line The line where this exception is constructed.
330 CloseTimeoutException(const char* file, int line)
331 : TimeoutException(file, line, "graceful connection closure timed out")
332 {
333 }
334
335 [[nodiscard]] const char* ice_id() const noexcept final;
336 };
337
338 /// The exception that is thrown when an invocation times out.
339 /// @headerfile Ice/Ice.h
340 class ICE_API InvocationTimeoutException final : public TimeoutException
341 {
342 public:
343 /// Constructs an InvocationTimeoutException.
344 /// @param file The file where this exception is constructed. This C string is not copied.
345 /// @param line The line where this exception is constructed.
346 InvocationTimeoutException(const char* file, int line) : TimeoutException(file, line, "invocation timed out") {}
347
348 [[nodiscard]] const char* ice_id() const noexcept final;
349 };
350
351 //
352 // Syscall exceptions
353 //
354
355 /// The exception that is thrown to report the failure of a system call.
356 /// @headerfile Ice/Ice.h
357 class ICE_API SyscallException : public LocalException
358 {
359 public:
360 /// The error code is a DWORD (unsigned long) on Windows and an int on other platforms.
361#ifdef _WIN32
362 using ErrorCode = unsigned long;
363#else
364 using ErrorCode = int;
365#endif
366
367 /// Constructs a SyscallException.
368 /// @param file The file where this exception is constructed. This C string is not copied.
369 /// @param line The line where this exception is constructed.
370 /// @param messagePrefix The start of the message returned by what().
371 /// @param error The error code.
372 SyscallException(const char* file, int line, std::string messagePrefix, ErrorCode error);
373
374 /// Gets the error number describing the system exception. On Unix, this is equivalent to
375 /// <code>errno</code>. On Windows, this is the value returned by <code>GetLastError()</code> or
376 /// <code>WSAGetLastError()</code>.
377 [[nodiscard]] ErrorCode error() const noexcept { return _error; }
378
379 [[nodiscard]] const char* ice_id() const noexcept override;
380
381 protected:
382 /// Constructs a SyscallException.
383 /// @param file The file where this exception is constructed. This C string is not copied.
384 /// @param line The line where this exception is constructed.
385 /// @param messagePrefix The start of the message returned by what().
386 /// @param error The error code.
387 /// @param errorToString A function that converts the error code to a string.
389 const char* file,
390 int line,
391 std::string messagePrefix,
393 const std::function<std::string(ErrorCode)>& errorToString);
394
395 /// Constructs a SyscallException without an error.
396 /// @param file The file where this exception is constructed. This C string is not copied.
397 /// @param line The line where this exception is constructed.
398 /// @param message The message returned by what().
399 SyscallException(const char* file, int line, std::string message)
400 : LocalException(file, line, std::move(message)),
401 _error(0)
402 {
403 }
404
405 private:
406 ErrorCode _error;
407 };
408
409 /// The exception that is thrown to report a DNS resolution failure.
410 /// @headerfile Ice/Ice.h
411 class ICE_API DNSException final : public SyscallException
412 {
413 public:
414 /// Constructs a DNSException.
415 /// @param file The file where this exception is constructed. This C string is not copied.
416 /// @param line The line where this exception is constructed.
417 /// @param error The error code.
418 /// @param host The host name that could not be resolved.
419 DNSException(const char* file, int line, ErrorCode error, std::string_view host);
420
421 [[nodiscard]] const char* ice_id() const noexcept final;
422 };
423
424 /// The exception that is thrown to report a file system error.
425 /// @headerfile Ice/Ice.h
426 class ICE_API FileException final : public SyscallException
427 {
428 public:
429 /// Constructs a FileException.
430 /// @param file The file where this exception is constructed. This C string is not copied.
431 /// @param line The line where this exception is constructed.
432 /// @param path The path of the file that caused the exception.
433 /// @param error The error code.
434 FileException(const char* file, int line, std::string_view path, ErrorCode error = 0);
435
436 [[nodiscard]] const char* ice_id() const noexcept final;
437 };
438
439 //
440 // Socket exceptions
441 //
442
443 /// The exception that is thrown to report a socket error.
444 /// @headerfile Ice/Ice.h
445 class ICE_API SocketException : public SyscallException
446 {
447 public:
448 /// Constructs a SocketException.
449 /// @param file The file where this exception is constructed. This C string is not copied.
450 /// @param line The line where this exception is constructed.
451 /// @param messagePrefix The start of the message returned by what().
452 /// @param error The error code.
453 SocketException(const char* file, int line, std::string messagePrefix, ErrorCode error);
454
455 /// Constructs a SocketException with a generic message.
456 /// @param file The file where this exception is constructed. This C string is not copied.
457 /// @param line The line where this exception is constructed.
458 /// @param error The error code.
459 SocketException(const char* file, int line, ErrorCode error)
460 : SocketException(file, line, "socket error", error)
461 {
462 }
463
464 /// Constructs a SocketException without an error.
465 /// @param file The file where this exception is constructed. This C string is not copied.
466 /// @param line The line where this exception is constructed.
467 /// @param message The message returned by what().
468 SocketException(const char* file, int line, std::string message)
469 : SyscallException(file, line, std::move(message))
470 {
471 }
472
473 [[nodiscard]] const char* ice_id() const noexcept override;
474
475 protected:
477 };
478
479 /// The exception that is thrown when a connection establishment fails.
480 /// @headerfile Ice/Ice.h
482 {
483 public:
485
486 [[nodiscard]] const char* ice_id() const noexcept override;
487 };
488
489 /// The exception that is thrown when an established connection is lost.
490 /// @headerfile Ice/Ice.h
491 class ICE_API ConnectionLostException final : public SocketException
492 {
493 public:
494 /// Constructs a ConnectionLostException.
495 /// @param file The file where this exception is constructed. This C string is not copied.
496 /// @param line The line where this exception is constructed.
497 /// @param error The error code.
498 ConnectionLostException(const char* file, int line, ErrorCode error);
499
500 [[nodiscard]] const char* ice_id() const noexcept final;
501 };
502
503 /// The exception that is thrown when the server host actively refuses a connection.
504 /// @headerfile Ice/Ice.h
506 {
507 public:
508 /// Constructs a ConnectionRefusedException.
509 /// @param file The file where this exception is constructed. This C string is not copied.
510 /// @param line The line where this exception is constructed.
511 ConnectionRefusedException(const char* file, int line)
512 : ConnectFailedException(file, line, "connection refused")
513 {
514 }
515
516 [[nodiscard]] const char* ice_id() const noexcept final;
517 };
518
519 //
520 // Other leaf local exceptions in alphabetical order.
521 //
522
523 /// The exception that is thrown when you attempt to register an object more than once with the Ice runtime.
524 /// @headerfile Ice/Ice.h
525 class ICE_API AlreadyRegisteredException final : public LocalException
526 {
527 public:
528 /// Constructs a AlreadyRegisteredException.
529 /// @param file The file where this exception is constructed. This C string is not copied.
530 /// @param line The line where this exception is constructed.
531 /// @param kindOfObject The kind of object that could not be removed: "servant", "facet", "object", "default
532 /// servant", "servant locator", "plugin", "object adapter", "object adapter with router", "replica group".
533 /// @param id The ID (or name) of the object that is registered already.
534 AlreadyRegisteredException(const char* file, int line, std::string kindOfObject, std::string id);
535
536 /// Gets the kind of object that could not be removed: "servant", "facet", "object", "default servant",
537 /// "servant locator", "plugin", "object adapter", "object adapter with router", "replica group".
538 [[nodiscard]] const std::string& kindOfObject() const noexcept { return *_kindOfObject; }
539
540 /// Gets the ID (or name) of the object that is registered already.
541 [[nodiscard]] const std::string& id() const noexcept { return *_id; }
542
543 [[nodiscard]] const char* ice_id() const noexcept final;
544
545 private:
546 std::shared_ptr<std::string> _kindOfObject;
547 std::shared_ptr<std::string> _id;
548 };
549
550 /// The exception that is thrown when an operation fails because the communicator has been destroyed.
551 /// @see Communicator#destroy
552 /// @headerfile Ice/Ice.h
554 {
555 public:
556 /// Constructs a CommunicatorDestroyedException.
557 /// @param file The file where this exception is constructed. This C string is not copied.
558 /// @param line The line where this exception is constructed.
559 CommunicatorDestroyedException(const char* file, int line)
560 : LocalException(file, line, "the Ice communicator object is destroyed")
561 {
562 }
563
564 [[nodiscard]] const char* ice_id() const noexcept final;
565 };
566
567 /// The exception that is thrown when an operation fails because the connection has been aborted.
568 /// @headerfile Ice/Ice.h
569 class ICE_API ConnectionAbortedException final : public LocalException
570 {
571 public:
572 /// Constructs a ConnectionAbortedException.
573 /// @param file The file where this exception is constructed. This C string is not copied.
574 /// @param line The line where this exception is constructed.
575 /// @param message The message returned by what().
576 /// @param closedByApplication True if the connection was aborted by the application, false if the connection
577 /// was aborted by the Ice runtime.
578 ConnectionAbortedException(const char* file, int line, std::string message, bool closedByApplication)
579 : LocalException(file, line, std::move(message)),
580 _closedByApplication(closedByApplication)
581 {
582 }
583
584 /// Returns true if the connection was aborted by the application, false if it was aborted by the Ice runtime.
585 [[nodiscard]] bool closedByApplication() const noexcept { return _closedByApplication; }
586
587 [[nodiscard]] const char* ice_id() const noexcept final;
588
589 private:
590 bool _closedByApplication;
591 };
592
593 /// The exception that is thrown when an operation fails because the connection has been closed gracefully.
594 /// @headerfile Ice/Ice.h
595 class ICE_API ConnectionClosedException final : public LocalException
596 {
597 public:
598 /// Constructs a ConnectionClosedException.
599 /// @param file The file where this exception is constructed. This C string is not copied.
600 /// @param line The line where this exception is constructed.
601 /// @param message The message returned by what().
602 /// @param closedByApplication True if the connection was closed by the application, false if the connection was
603 /// closed by the Ice runtime.
604 ConnectionClosedException(const char* file, int line, std::string message, bool closedByApplication)
605 : LocalException(file, line, std::move(message)),
606 _closedByApplication(closedByApplication)
607 {
608 }
609
610 /// Returns true if the connection was closed by the application, false if it was closed by the Ice runtime.
611 [[nodiscard]] bool closedByApplication() const noexcept { return _closedByApplication; }
612
613 [[nodiscard]] const char* ice_id() const noexcept final;
614
615 private:
616 bool _closedByApplication;
617 };
618
619 /// The exception that is thrown when attempting to use an unsupported feature.
620 /// @headerfile Ice/Ice.h
621 class ICE_API FeatureNotSupportedException final : public LocalException
622 {
623 public:
625
626 [[nodiscard]] const char* ice_id() const noexcept final;
627 };
628
629 /// The exception that is thrown when attempting to change a connection-related property on a fixed proxy.
630 /// @headerfile Ice/Ice.h
631 class ICE_API FixedProxyException final : public LocalException
632 {
633 public:
634 /// Constructs a FixedProxyException.
635 /// @param file The file where this exception is constructed. This C string is not copied.
636 /// @param line The line where this exception is constructed.
637 FixedProxyException(const char* file, int line)
638 : LocalException(file, line, "cannot change the properties of a fixed proxy")
639 {
640 }
641
642 [[nodiscard]] const char* ice_id() const noexcept final;
643 };
644
645 /// The exception that is thrown when communicator initialization fails.
646 /// @headerfile Ice/Ice.h
647 class ICE_API InitializationException final : public LocalException
648 {
649 public:
651
652 [[nodiscard]] const char* ice_id() const noexcept final;
653 };
654
655 /// The exception that is thrown when an asynchronous invocation fails because it was canceled explicitly by the
656 /// user.
657 /// @headerfile Ice/Ice.h
658 class ICE_API InvocationCanceledException final : public LocalException
659 {
660 public:
661 /// Constructs an InvocationCanceledException.
662 /// @param file The file where this exception is constructed. This C string is not copied.
663 /// @param line The line where this exception is constructed.
664 InvocationCanceledException(const char* file, int line) : LocalException(file, line, "invocation canceled") {}
665
666 [[nodiscard]] const char* ice_id() const noexcept final;
667 };
668
669 /// The exception that is thrown when the Ice runtime cannot find a suitable endpoint to connect to.
670 /// @headerfile Ice/Ice.h
671 class ICE_API NoEndpointException final : public LocalException
672 {
673 public:
675
676 /// Constructs a NoEndpointException.
677 /// @param file The file where this exception is constructed. This C string is not copied.
678 /// @param line The line where this exception is constructed.
679 /// @param proxy The proxy used to create the message return by what().
680 NoEndpointException(const char* file, int line, const ObjectPrx& proxy);
681
682 [[nodiscard]] const char* ice_id() const noexcept final;
683 };
684
685 /// An attempt was made to find or deregister something that is not registered with Ice.
686 /// @headerfile Ice/Ice.h
687 class ICE_API NotRegisteredException final : public LocalException
688 {
689 public:
690 /// Constructs a NotRegisteredException.
691 /// @param file The file where this exception is constructed. This C string is not copied.
692 /// @param line The line where this exception is constructed.
693 /// @param kindOfObject The kind of object that is not registered.
694 /// @param id The ID (or name) of the object that is not registered.
695 NotRegisteredException(const char* file, int line, std::string kindOfObject, std::string id);
696
697 /// Gets the kind of object that is not registered.
698 [[nodiscard]] const std::string& kindOfObject() const noexcept { return *_kindOfObject; }
699
700 /// Gets the ID (or name) of the object that is not registered.
701 [[nodiscard]] const std::string& id() const noexcept { return *_id; };
702
703 [[nodiscard]] const char* ice_id() const noexcept final;
704
705 private:
706 std::shared_ptr<std::string> _kindOfObject;
707 std::shared_ptr<std::string> _id;
708 };
709
710 /// The exception that is thrown when attempting to use an ObjectAdapter that has been deactivated.
711 /// @see ObjectAdapter#deactivate
712 /// @see Communicator#shutdown
713 /// @headerfile Ice/Ice.h
715 {
716 public:
717 /// Constructs an ObjectAdapterDeactivatedException.
718 /// @param file The file where this exception is constructed. This C string is not copied.
719 /// @param line The line where this exception is constructed.
720 /// @param name The name of the object adapter that is deactivated.
721 ObjectAdapterDeactivatedException(const char* file, int line, std::string_view name)
722 : LocalException(file, line, "object adapter '" + std::string{name} + "' is deactivated")
723 {
724 }
725
726 [[nodiscard]] const char* ice_id() const noexcept final;
727 };
728
729 /// The exception that is thrown when attempting to use an ObjectAdapter that has been destroyed.
730 /// @headerfile Ice/Ice.h
732 {
733 public:
734 /// Constructs an ObjectAdapterDestroyedException.
735 /// @param file The file where this exception is constructed. This C string is not copied.
736 /// @param line The line where this exception is constructed.
737 /// @param name The name of the object adapter that is destroyed.
738 ObjectAdapterDestroyedException(const char* file, int line, std::string_view name)
739 : LocalException(file, line, "object adapter '" + std::string{name} + "' is destroyed")
740 {
741 }
742
743 [[nodiscard]] const char* ice_id() const noexcept final;
744 };
745
746 /// The exception that is thrown when an ObjectAdapter cannot be activated. This can happen when the locator
747 /// implementation detects another active ObjectAdapter with the same adapter ID.
748 /// @headerfile Ice/Ice.h
750 {
751 public:
752 /// Constructs an ObjectAdapterIdInUseException.
753 /// @param file The file where this exception is constructed. This C string is not copied.
754 /// @param line The line where this exception is constructed.
755 /// @param adapterId The adapter ID used to create the message returned by what().
756 ObjectAdapterIdInUseException(const char* file, int line, std::string_view adapterId)
757 : LocalException(file, line, "an object adapter with ID '" + std::string{adapterId} + "' is already active")
758 {
759 }
760
761 [[nodiscard]] const char* ice_id() const noexcept final;
762 };
763
764 /// The exception that is thrown when the parsing of a string fails.
765 /// @headerfile Ice/Ice.h
766 class ICE_API ParseException final : public LocalException
767 {
768 public:
770
771 [[nodiscard]] const char* ice_id() const noexcept final;
772 };
773
774 /// The exception that is thrown when the initialization of an Ice plugin fails.
775 /// @headerfile Ice/Ice.h
777 {
778 public:
780
781 [[nodiscard]] const char* ice_id() const noexcept final;
782 };
783
784 /// The exception that is thrown when a failure occurs in the security subsystem. This includes IceSSL errors.
785 /// @headerfile Ice/Ice.h
786 class ICE_API SecurityException final : public LocalException
787 {
788 public:
790
791 [[nodiscard]] const char* ice_id() const noexcept final;
792 };
793
794 /// The exception that is thrown when attempting to invoke an operation with `ice_oneway`, `ice_batchOneway`,
795 /// `ice_datagram`, or `ice_batchDatagram`, and the operation has a return value, an out parameter, or an exception
796 /// specification.
797 /// @headerfile Ice/Ice.h
798 class ICE_API TwowayOnlyException final : public LocalException
799 {
800 public:
801 /// Constructs a TwowayOnlyException.
802 /// @param file The file where this exception is constructed. This C string is not copied.
803 /// @param line The line where this exception is constructed.
804 /// @param operation The two-way only operation used to create the message returned by what().
805 TwowayOnlyException(const char* file, int line, std::string_view operation)
807 file,
808 line,
809 "cannot invoke operation '" + std::string{operation} +
810 "' with a oneway, batchOneway, datagram, or batchDatagram proxy")
811 {
812 }
813
814 [[nodiscard]] const char* ice_id() const noexcept final;
815 };
816
817 /// The exception that is thrown when a property cannot be set or retrieved. For example, this exception is thrown
818 /// when attempting to set an unknown Ice property.
819 class ICE_API PropertyException final : public LocalException
820 {
821 public:
823
824 [[nodiscard]] const char* ice_id() const noexcept final;
825 };
826}
827
828#endif
const std::string & id() const noexcept
Gets the ID (or name) of the object that is registered already.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
AlreadyRegisteredException(const char *file, int line, std::string kindOfObject, std::string id)
Constructs a AlreadyRegisteredException.
const std::string & kindOfObject() const noexcept
Gets the kind of object that could not be removed: "servant", "facet", "object", "default servant",...
CloseConnectionException(const char *file, int line)
Constructs a CloseConnectionException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
CloseTimeoutException(const char *file, int line)
Constructs a CloseTimeoutException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
CommunicatorDestroyedException(const char *file, int line)
Constructs a CommunicatorDestroyedException.
SocketException(const char *file, int line, std::string messagePrefix, ErrorCode error)
Constructs a SocketException.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
The exception that is thrown when a connection establishment fails.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ConnectTimeoutException(const char *file, int line)
Constructs a ConnectTimeoutException.
ConnectionAbortedException(const char *file, int line, std::string message, bool closedByApplication)
Constructs a ConnectionAbortedException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
bool closedByApplication() const noexcept
Returns true if the connection was aborted by the application, false if it was aborted by the Ice run...
bool closedByApplication() const noexcept
Returns true if the connection was closed by the application, false if it was closed by the Ice runti...
ConnectionClosedException(const char *file, int line, std::string message, bool closedByApplication)
Constructs a ConnectionClosedException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ConnectionLostException(const char *file, int line, ErrorCode error)
Constructs a ConnectionLostException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ConnectionRefusedException(const char *file, int line)
Constructs a ConnectionRefusedException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
DNSException(const char *file, int line, ErrorCode error, std::string_view host)
Constructs a DNSException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
DatagramLimitException(const char *file, int line)
Constructs a DatagramLimitException.
DispatchException(const char *file, int line, ReplyStatus replyStatus, std::optional< std::string > message=std::nullopt)
Constructs a DispatchException.
ReplyStatus replyStatus() const noexcept
Gets the reply status.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
FacetNotExistException(const char *file, int line)
Constructs a FacetNotExistException without specifying the details of the current request.
FacetNotExistException(const char *file, int line, Identity id, std::string facet, std::string operation)
Constructs a FacetNotExistException.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
The exception that is thrown when attempting to use an unsupported feature.
FileException(const char *file, int line, std::string_view path, ErrorCode error=0)
Constructs a FileException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
FixedProxyException(const char *file, int line)
Constructs a FixedProxyException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
The exception that is thrown when communicator initialization fails.
InvocationCanceledException(const char *file, int line)
Constructs an InvocationCanceledException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
InvocationTimeoutException(const char *file, int line)
Constructs an InvocationTimeoutException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
The exception that is thrown when an error occurs during marshaling or unmarshaling.
NoEndpointException(const char *file, int line, const ObjectPrx &proxy)
Constructs a NoEndpointException.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
const std::string & kindOfObject() const noexcept
Gets the kind of object that is not registered.
NotRegisteredException(const char *file, int line, std::string kindOfObject, std::string id)
Constructs a NotRegisteredException.
const std::string & id() const noexcept
Gets the ID (or name) of the object that is not registered.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ObjectAdapterDeactivatedException(const char *file, int line, std::string_view name)
Constructs an ObjectAdapterDeactivatedException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ObjectAdapterDestroyedException(const char *file, int line, std::string_view name)
Constructs an ObjectAdapterDestroyedException.
ObjectAdapterIdInUseException(const char *file, int line, std::string_view adapterId)
Constructs an ObjectAdapterIdInUseException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ObjectNotExistException(const char *file, int line)
Constructs an ObjectNotExistException without specifying the details of the current request.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
ObjectNotExistException(const char *file, int line, Identity id, std::string facet, std::string operation)
Constructs an ObjectNotExistException.
The base class for all Ice proxies.
Definition Proxy.h:232
const char * ice_id() const noexcept final
Returns the type ID of this exception.
OperationNotExistException(const char *file, int line)
Constructs an OperationNotExistException without specifying the details of the current request.
OperationNotExistException(const char *file, int line, Identity id, std::string facet, std::string operation)
Constructs an OperationNotExistException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
The exception that is thrown when the parsing of a string fails.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
The exception that is thrown when the initialization of an Ice plugin fails.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
The exception that is thrown when a property cannot be set or retrieved.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
The base class for exceptions related to the Ice protocol.
const std::string & operation() const noexcept
The operation name of the request.
const Identity & id() const noexcept
The identity of the Ice Object to which the request was sent.
const std::string & facet() const noexcept
The facet to which the request was sent.
The base class for the 3 NotExist exceptions.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
The exception that is thrown when a failure occurs in the security subsystem.
SocketException(const char *file, int line, std::string messagePrefix, ErrorCode error)
Constructs a SocketException.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
SocketException(const char *file, int line, std::string message)
Constructs a SocketException without an error.
SyscallException(const char *file, int line, std::string messagePrefix, ErrorCode error)
Constructs a SyscallException.
SocketException(const char *file, int line, ErrorCode error)
Constructs a SocketException with a generic message.
int ErrorCode
The error code is a DWORD (unsigned long) on Windows and an int on other platforms.
ErrorCode error() const noexcept
Gets the error number describing the system exception.
SyscallException(const char *file, int line, std::string messagePrefix, ErrorCode error)
Constructs a SyscallException.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
LocalException(const char *file, int line, std::string message)
Constructs a local exception.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
The exception that is thrown when a timeout occurs.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
TwowayOnlyException(const char *file, int line, std::string_view operation)
Constructs a TwowayOnlyException.
UnknownException(const char *file, int line, std::string message)
Constructs an UnknownException.
const char * ice_id() const noexcept override
Returns the type ID of this exception.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
UnknownLocalException(const char *file, int line, std::string message)
Constructs an UnknownLocalException.
const char * ice_id() const noexcept final
Returns the type ID of this exception.
UnknownUserException(const char *file, int line, std::string message)
Constructs an UnknownUserException.
static UnknownUserException fromTypeId(const char *file, int line, const char *typeId)
Creates an UnknownUserException from the type ID of an unexpected exception.
ReplyStatus
Represents the status of a reply.
Definition ReplyStatus.h:28
The Ice RPC framework.
Definition SampleEvent.h:59
Represents the identity of an Ice object.
Definition Identity.h:40