exception.h
1 
5 #pragma once
6 
7 #include <exception>
8 #include <string>
9 #include <utility>
10 
11 namespace ucxx {
12 
18 class Error : public std::exception {
19  private:
20  std::string _msg{};
21 
22  public:
30  explicit Error(const std::string& msg) : _msg{std::move(msg)} {}
31 
39  const char* what() const noexcept override { return this->_msg.c_str(); }
40 };
41 
47 class NoMessageError : public Error {
48  public:
56  explicit NoMessageError(const std::string& msg) : Error(msg) {}
57 };
58 
64 class NoResourceError : public Error {
65  public:
73  explicit NoResourceError(const std::string& msg) : Error(msg) {}
74 };
75 
81 class IOError : public Error {
82  public:
90  explicit IOError(const std::string& msg) : Error(msg) {}
91 };
92 
98 class NoMemoryError : public Error {
99  public:
107  explicit NoMemoryError(const std::string& msg) : Error(msg) {}
108 };
109 
115 class InvalidParamError : public Error {
116  public:
124  explicit InvalidParamError(const std::string& msg) : Error(msg) {}
125 };
126 
132 class UnreachableError : public Error {
133  public:
141  explicit UnreachableError(const std::string& msg) : Error(msg) {}
142 };
143 
149 class InvalidAddrError : public Error {
150  public:
158  explicit InvalidAddrError(const std::string& msg) : Error(msg) {}
159 };
160 
166 class NotImplementedError : public Error {
167  public:
175  explicit NotImplementedError(const std::string& msg) : Error(msg) {}
176 };
177 
183 class MessageTruncatedError : public Error {
184  public:
192  explicit MessageTruncatedError(const std::string& msg) : Error(msg) {}
193 };
194 
200 class NoProgressError : public Error {
201  public:
209  explicit NoProgressError(const std::string& msg) : Error(msg) {}
210 };
211 
217 class BufferTooSmallError : public Error {
218  public:
226  explicit BufferTooSmallError(const std::string& msg) : Error(msg) {}
227 };
228 
234 class NoElemError : public Error {
235  public:
243  explicit NoElemError(const std::string& msg) : Error(msg) {}
244 };
245 
252  public:
260  explicit SomeConnectsFailedError(const std::string& msg) : Error(msg) {}
261 };
262 
268 class NoDeviceError : public Error {
269  public:
277  explicit NoDeviceError(const std::string& msg) : Error(msg) {}
278 };
279 
285 class BusyError : public Error {
286  public:
294  explicit BusyError(const std::string& msg) : Error(msg) {}
295 };
296 
302 class CanceledError : public Error {
303  public:
311  explicit CanceledError(const std::string& msg) : Error(msg) {}
312 };
313 
319 class ShmemSegmentError : public Error {
320  public:
328  explicit ShmemSegmentError(const std::string& msg) : Error(msg) {}
329 };
330 
336 class AlreadyExistsError : public Error {
337  public:
345  explicit AlreadyExistsError(const std::string& msg) : Error(msg) {}
346 };
347 
353 class OutOfRangeError : public Error {
354  public:
362  explicit OutOfRangeError(const std::string& msg) : Error(msg) {}
363 };
364 
370 class TimedOutError : public Error {
371  public:
379  explicit TimedOutError(const std::string& msg) : Error(msg) {}
380 };
381 
387 class ExceedsLimitError : public Error {
388  public:
396  explicit ExceedsLimitError(const std::string& msg) : Error(msg) {}
397 };
398 
404 class UnsupportedError : public Error {
405  public:
413  explicit UnsupportedError(const std::string& msg) : Error(msg) {}
414 };
415 
421 class RejectedError : public Error {
422  public:
430  explicit RejectedError(const std::string& msg) : Error(msg) {}
431 };
432 
438 class NotConnectedError : public Error {
439  public:
447  explicit NotConnectedError(const std::string& msg) : Error(msg) {}
448 };
449 
455 class ConnectionResetError : public Error {
456  public:
464  explicit ConnectionResetError(const std::string& msg) : Error(msg) {}
465 };
466 
472 class FirstLinkFailureError : public Error {
473  public:
481  explicit FirstLinkFailureError(const std::string& msg) : Error(msg) {}
482 };
483 
489 class LastLinkFailureError : public Error {
490  public:
498  explicit LastLinkFailureError(const std::string& msg) : Error(msg) {}
499 };
500 
507  public:
515  explicit FirstEndpointFailureError(const std::string& msg) : Error(msg) {}
516 };
517 
523 class EndpointTimeoutError : public Error {
524  public:
532  explicit EndpointTimeoutError(const std::string& msg) : Error(msg) {}
533 };
534 
541  public:
549  explicit LastEndpointFailureError(const std::string& msg) : Error(msg) {}
550 };
551 
552 } // namespace ucxx
The exception for UCS_ERR_ALREADY_EXISTS.
Definition: exception.h:336
AlreadyExistsError(const std::string &msg)
The UCS_ERR_ALREADY_EXISTS constructor.
Definition: exception.h:345
The exception for UCS_ERR_BUFFER_TOO_SMALL.
Definition: exception.h:217
BufferTooSmallError(const std::string &msg)
The UCS_ERR_BUFFER_TOO_SMALL constructor.
Definition: exception.h:226
The exception for UCS_ERR_BUSY.
Definition: exception.h:285
BusyError(const std::string &msg)
The UCS_ERR_BUSY constructor.
Definition: exception.h:294
The exception for UCS_ERR_CANCELED.
Definition: exception.h:302
CanceledError(const std::string &msg)
The UCS_ERR_CANCELED constructor.
Definition: exception.h:311
The exception for UCS_ERR_CONNECTION_RESET.
Definition: exception.h:455
ConnectionResetError(const std::string &msg)
The UCS_ERR_CONNECTION_RESET constructor.
Definition: exception.h:464
The exception for UCS_ERR_ENDPOINT_TIMEOUT.
Definition: exception.h:523
EndpointTimeoutError(const std::string &msg)
The UCS_ERR_ENDPOINT_TIMEOUT constructor.
Definition: exception.h:532
The base class for all UCX exceptions.
Definition: exception.h:18
const char * what() const noexcept override
Returns an explanatory string.
Definition: exception.h:39
Error(const std::string &msg)
The base class constructor.
Definition: exception.h:30
The exception for UCS_ERR_EXCEEDS_LIMIT.
Definition: exception.h:387
ExceedsLimitError(const std::string &msg)
The UCS_ERR_EXCEEDS_LIMIT constructor.
Definition: exception.h:396
The exception for UCS_ERR_FIRST_ENDPOINT_FAILURE.
Definition: exception.h:506
FirstEndpointFailureError(const std::string &msg)
The UCS_ERR_FIRST_ENDPOINT_FAILURE constructor.
Definition: exception.h:515
The exception for UCS_ERR_FIRST_LINK_FAILURE.
Definition: exception.h:472
FirstLinkFailureError(const std::string &msg)
The UCS_ERR_FIRST_LINK_FAILURE constructor.
Definition: exception.h:481
The exception for UCS_ERR_IO_ERROR.
Definition: exception.h:81
IOError(const std::string &msg)
The UCS_ERR_IO_ERROR constructor.
Definition: exception.h:90
The exception for UCS_ERR_INVALID_ADDR.
Definition: exception.h:149
InvalidAddrError(const std::string &msg)
The UCS_ERR_INVALID_ADDR constructor.
Definition: exception.h:158
The exception for UCS_ERR_INVALID_PARAM.
Definition: exception.h:115
InvalidParamError(const std::string &msg)
The UCS_ERR_INVALID_PARAM constructor.
Definition: exception.h:124
The exception for UCS_ERR_LAST_ENDPOINT_FAILURE.
Definition: exception.h:540
LastEndpointFailureError(const std::string &msg)
The UCS_ERR_LAST_ENDPOINT_FAILURE constructor.
Definition: exception.h:549
The exception for UCS_ERR_LAST_LINK_FAILURE.
Definition: exception.h:489
LastLinkFailureError(const std::string &msg)
The UCS_ERR_LAST_LINK_FAILURE constructor.
Definition: exception.h:498
The exception for UCS_ERR_MESSAGE_TRUNCATED.
Definition: exception.h:183
MessageTruncatedError(const std::string &msg)
The UCS_ERR_MESSAGE_TRUNCATED constructor.
Definition: exception.h:192
The exception for UCS_ERR_NO_DEVICE.
Definition: exception.h:268
NoDeviceError(const std::string &msg)
The UCS_ERR_NO_DEVICE constructor.
Definition: exception.h:277
The exception for UCS_ERR_NO_ELEM.
Definition: exception.h:234
NoElemError(const std::string &msg)
The UCS_ERR_NO_ELEM constructor.
Definition: exception.h:243
The exception for UCS_ERR_NO_MEMORY.
Definition: exception.h:98
NoMemoryError(const std::string &msg)
The UCS_ERR_NO_MEMORY constructor.
Definition: exception.h:107
The exception for UCS_ERR_NO_MESSAGE.
Definition: exception.h:47
NoMessageError(const std::string &msg)
The UCS_ERR_NO_MESSAGE constructor.
Definition: exception.h:56
The exception for UCS_ERR_NO_PROGRESS.
Definition: exception.h:200
NoProgressError(const std::string &msg)
The UCS_ERR_NO_PROGRESS constructor.
Definition: exception.h:209
The exception for UCS_ERR_NO_RESOURCE.
Definition: exception.h:64
NoResourceError(const std::string &msg)
The UCS_ERR_NO_RESOURCE constructor.
Definition: exception.h:73
The exception for UCS_ERR_NOT_CONNECTED.
Definition: exception.h:438
NotConnectedError(const std::string &msg)
The UCS_ERR_NOT_CONNECTED constructor.
Definition: exception.h:447
The exception for UCS_ERR_NOT_IMPLEMENTED.
Definition: exception.h:166
NotImplementedError(const std::string &msg)
The UCS_ERR_NOT_IMPLEMENTED constructor.
Definition: exception.h:175
The exception for UCS_ERR_OUT_OF_RANGE.
Definition: exception.h:353
OutOfRangeError(const std::string &msg)
The UCS_ERR_OUT_OF_RANGE constructor.
Definition: exception.h:362
The exception for UCS_ERR_REJECTED.
Definition: exception.h:421
RejectedError(const std::string &msg)
The UCS_ERR_REJECTED constructor.
Definition: exception.h:430
The exception for UCS_ERR_SHMEM_SEGMENT.
Definition: exception.h:319
ShmemSegmentError(const std::string &msg)
The UCS_ERR_SHMEM_SEGMENT constructor.
Definition: exception.h:328
The exception for UCS_ERR_SOME_CONNECTS_FAILED.
Definition: exception.h:251
SomeConnectsFailedError(const std::string &msg)
The UCS_ERR_SOME_CONNECTS_FAILED constructor.
Definition: exception.h:260
The exception for UCS_ERR_TIMED_OUT.
Definition: exception.h:370
TimedOutError(const std::string &msg)
The UCS_ERR_TIMED_OUT constructor.
Definition: exception.h:379
The exception for UCS_ERR_UNREACHABLE.
Definition: exception.h:132
UnreachableError(const std::string &msg)
The UCS_ERR_UNREACHABLE constructor.
Definition: exception.h:141
The exception for UCS_ERR_UNSUPPORTED.
Definition: exception.h:404
UnsupportedError(const std::string &msg)
The UCS_ERR_UNSUPPORTED constructor.
Definition: exception.h:413
Definition: address.h:15