| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | #nullable enable |
| | 4 | |
|
| | 5 | | using System.Diagnostics; |
| | 6 | |
|
| | 7 | | namespace Ice; |
| | 8 | |
|
| | 9 | | // This file contains all the exception classes derived from LocalException defined in the Ice assembly. |
| | 10 | |
|
| | 11 | | // |
| | 12 | | // Dispatch exceptions |
| | 13 | | // |
| | 14 | |
|
| | 15 | | /// <summary> |
| | 16 | | /// The dispatch failed. This is the base class for local exceptions that can be marshaled and transmitted "over the |
| | 17 | | /// wire". |
| | 18 | | /// </summary> |
| | 19 | | public class DispatchException : LocalException |
| | 20 | | { |
| | 21 | | /// <summary> |
| | 22 | | /// Gets the reply status of this exception. |
| | 23 | | /// </summary> |
| | 24 | | public ReplyStatus replyStatus { get; } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Initializes a new instance of the <see cref="DispatchException" /> class. |
| | 28 | | /// </summary> |
| | 29 | | /// <param name="replyStatus">The reply status. It must be greater than <see cref="ReplyStatus.UserException" />. |
| | 30 | | /// </param> |
| | 31 | | /// <param name="message">The exception message.</param> |
| | 32 | | /// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="replyStatus" /> is equal to <see |
| | 33 | | /// cref="ReplyStatus.Ok" /> or <see cref="ReplyStatus.UserException" />.</exception> |
| | 34 | | public DispatchException(ReplyStatus replyStatus, string? message = null) |
| | 35 | | : base(message ?? $"The dispatch failed with reply status {replyStatus}.") => |
| | 36 | | this.replyStatus = replyStatus > ReplyStatus.UserException && (byte)replyStatus <= 255 ? replyStatus : |
| | 37 | | throw new ArgumentOutOfRangeException( |
| | 38 | | nameof(replyStatus), |
| | 39 | | $"The reply status of a {nameof(DispatchException)} must fit in a byte and be greater than {nameof(Reply |
| | 40 | |
|
| | 41 | | /// <inheritdoc/> |
| | 42 | | public override string ice_id() => "::Ice::DispatchException"; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// The base exception for the 3 NotExist exceptions. It cannot be instantiated directly. |
| | 47 | | /// </summary> |
| | 48 | | public class RequestFailedException : DispatchException |
| | 49 | | { |
| | 50 | | /// <summary> |
| | 51 | | /// Gets the identity of the Ice Object to which the request was sent. |
| | 52 | | /// </summary> |
| | 53 | | public Identity id { get; } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Gets the facet to which the request was sent. |
| | 57 | | /// </summary> |
| | 58 | | public string facet { get; } |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets the operation name of the request. |
| | 62 | | /// </summary> |
| | 63 | | public string operation { get; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Initializes a new instance of the <see cref="RequestFailedException" /> class. |
| | 67 | | /// </summary> |
| | 68 | | /// <param name="replyStatus">The reply status.</param> |
| | 69 | | /// <param name="id">The identity of the Ice Object to which the request was sent.</param> |
| | 70 | | /// <param name="facet">The facet to which the request was sent.</param> |
| | 71 | | /// <param name="operation">The operation name of the request.</param> |
| | 72 | | private protected RequestFailedException( |
| | 73 | | ReplyStatus replyStatus, |
| | 74 | | Identity id, |
| | 75 | | string facet, |
| | 76 | | string operation) |
| | 77 | | : base(replyStatus, createMessage(replyStatus, id, facet, operation)) |
| | 78 | | { |
| | 79 | | Debug.Assert(replyStatus is ReplyStatus.ObjectNotExist or |
| | 80 | | ReplyStatus.FacetNotExist or |
| | 81 | | ReplyStatus.OperationNotExist); |
| | 82 | | this.id = id; |
| | 83 | | this.facet = facet; |
| | 84 | | this.operation = operation; |
| | 85 | | } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// Initializes a new instance of the <see cref="RequestFailedException" /> class. |
| | 89 | | /// </summary> |
| | 90 | | /// <param name="replyStatus">The reply status.</param> |
| | 91 | | private protected RequestFailedException(ReplyStatus replyStatus) |
| | 92 | | : base(replyStatus) |
| | 93 | | { |
| | 94 | | Debug.Assert(replyStatus is ReplyStatus.ObjectNotExist or |
| | 95 | | ReplyStatus.FacetNotExist or |
| | 96 | | ReplyStatus.OperationNotExist); |
| | 97 | |
|
| | 98 | | id = new Identity(); |
| | 99 | | facet = ""; |
| | 100 | | operation = ""; |
| | 101 | | } |
| | 102 | |
|
| | 103 | | private static string createMessage(ReplyStatus replyStatus, Identity id, string facet, string operation) => |
| | 104 | | $"Dispatch failed with {replyStatus} {{ id = '{Util.identityToString(id)}', facet = '{facet}', operation = '{ope |
| | 105 | | } |
| | 106 | |
|
| | 107 | | /// <summary> |
| | 108 | | /// The dispatch could not find a servant for the identity carried by the request. |
| | 109 | | /// </summary> |
| | 110 | | public sealed class ObjectNotExistException : RequestFailedException |
| | 111 | | { |
| | 112 | | /// <summary> |
| | 113 | | /// Initializes a new instance of the <see cref="ObjectNotExistException" /> class. |
| | 114 | | /// </summary> |
| | 115 | | public ObjectNotExistException() |
| | 116 | | : base(ReplyStatus.ObjectNotExist) |
| | 117 | | { |
| | 118 | | } |
| | 119 | |
|
| | 120 | | /// <summary> |
| | 121 | | /// Initializes a new instance of the <see cref="ObjectNotExistException" /> class. |
| | 122 | | /// </summary> |
| | 123 | | /// <param name="id">The identity of the Ice Object to which the request was sent.</param> |
| | 124 | | /// <param name="facet">The facet to which the request was sent.</param> |
| | 125 | | /// <param name="operation">The operation name of the request.</param> |
| | 126 | | public ObjectNotExistException(Identity id, string facet, string operation) |
| | 127 | | : base(ReplyStatus.ObjectNotExist, id, facet, operation) |
| | 128 | | { |
| | 129 | | } |
| | 130 | |
|
| | 131 | | /// <inheritdoc/> |
| | 132 | | public override string ice_id() => "::Ice::ObjectNotExistException"; |
| | 133 | | } |
| | 134 | |
|
| | 135 | | /// <summary> |
| | 136 | | /// The dispatch could not find a servant for the identity + facet carried by the request. |
| | 137 | | /// </summary> |
| | 138 | | public sealed class FacetNotExistException : RequestFailedException |
| | 139 | | { |
| | 140 | | /// <summary> |
| | 141 | | /// Initializes a new instance of the <see cref="FacetNotExistException" /> class. |
| | 142 | | /// </summary> |
| | 143 | | public FacetNotExistException() |
| | 144 | | : base(ReplyStatus.FacetNotExist) |
| | 145 | | { |
| | 146 | | } |
| | 147 | |
|
| | 148 | | /// <summary> |
| | 149 | | /// Initializes a new instance of the <see cref="FacetNotExistException" /> class. |
| | 150 | | /// </summary> |
| | 151 | | /// <param name="id">The identity of the Ice Object to which the request was sent.</param> |
| | 152 | | /// <param name="facet">The facet to which the request was sent.</param> |
| | 153 | | /// <param name="operation">The operation name of the request.</param> |
| | 154 | | public FacetNotExistException(Identity id, string facet, string operation) |
| | 155 | | : base(ReplyStatus.FacetNotExist, id, facet, operation) |
| | 156 | | { |
| | 157 | | } |
| | 158 | |
|
| | 159 | | /// <inheritdoc/> |
| | 160 | | public override string ice_id() => "::Ice::FacetNotExistException"; |
| | 161 | | } |
| | 162 | |
|
| | 163 | | /// <summary> |
| | 164 | | /// The dispatch could not find the operation carried by the request on the target servant. This is typically due |
| | 165 | | /// to a mismatch in the Slice definitions, such as the client using Slice definitions newer than the server's. |
| | 166 | | /// </summary> |
| | 167 | | public sealed class OperationNotExistException : RequestFailedException |
| | 168 | | { |
| | 169 | | /// <summary> |
| | 170 | | /// Initializes a new instance of the <see cref="OperationNotExistException" /> class. |
| | 171 | | /// </summary> |
| | 172 | | public OperationNotExistException() |
| | 173 | | : base(ReplyStatus.OperationNotExist) |
| | 174 | | { |
| | 175 | | } |
| | 176 | |
|
| | 177 | | /// <summary> |
| | 178 | | /// Initializes a new instance of the <see cref="OperationNotExistException" /> class. |
| | 179 | | /// </summary> |
| | 180 | | /// <param name="id">The identity of the Ice Object to which the request was sent.</param> |
| | 181 | | /// <param name="facet">The facet to which the request was sent.</param> |
| | 182 | | /// <param name="operation">The operation name of the request.</param> |
| | 183 | | public OperationNotExistException(Identity id, string facet, string operation) |
| | 184 | | : base(ReplyStatus.OperationNotExist, id, facet, operation) |
| | 185 | | { |
| | 186 | | } |
| | 187 | |
|
| | 188 | | /// <inheritdoc/> |
| | 189 | | public override string ice_id() => "::Ice::OperationNotExistException"; |
| | 190 | | } |
| | 191 | |
|
| | 192 | | /// <summary> |
| | 193 | | /// The dispatch failed with an exception that does not map to a more specific <see cref="ReplyStatus" /> value. |
| | 194 | | /// This is the fallback exception when reporting a dispatch failure. |
| | 195 | | /// </summary> |
| | 196 | | /// <remarks>This exception is equivalent to a <see cref="DispatchException" /> with reply status |
| | 197 | | /// <see cref="ReplyStatus.UnknownException"/>.</remarks> |
| | 198 | | public class UnknownException : DispatchException |
| | 199 | | { |
| | 200 | | /// <summary> |
| | 201 | | /// Initializes a new instance of the <see cref="UnknownException" /> class. |
| | 202 | | /// </summary> |
| | 203 | | /// <param name="message">The exception message.</param> |
| | 204 | | public UnknownException(string message) |
| | 205 | | : base(ReplyStatus.UnknownException, message) |
| | 206 | | { |
| | 207 | | } |
| | 208 | |
|
| | 209 | | /// <inheritdoc/> |
| | 210 | | public override string ice_id() => "::Ice::UnknownException"; |
| | 211 | |
|
| | 212 | | /// <summary> |
| | 213 | | /// Initializes a new instance of the <see cref="UnknownException" /> class. |
| | 214 | | /// </summary> |
| | 215 | | /// <param name="replyStatus">The reply status.</param> |
| | 216 | | /// <param name="message">The exception message.</param> |
| | 217 | | private protected UnknownException(ReplyStatus replyStatus, string message) |
| | 218 | | : base(replyStatus, message) |
| | 219 | | { |
| | 220 | | } |
| | 221 | | } |
| | 222 | |
|
| | 223 | | /// <summary> |
| | 224 | | /// The dispatch failed with a <see cref="LocalException" /> that cannot be marshaled and that cannot converted into a |
| | 225 | | /// more specific <see cref="ReplyStatus" />. |
| | 226 | | /// </summary> |
| | 227 | | /// <remarks>This exception is equivalent to a <see cref="DispatchException" /> with reply status |
| | 228 | | /// <see cref="ReplyStatus.UnknownLocalException"/>.</remarks> |
| | 229 | | public sealed class UnknownLocalException : UnknownException |
| | 230 | | { |
| | 231 | | /// <summary> |
| | 232 | | /// Initializes a new instance of the <see cref="UnknownLocalException" /> class. |
| | 233 | | /// </summary> |
| | 234 | | /// <param name="message">The exception message.</param> |
| | 235 | | public UnknownLocalException(string message) |
| | 236 | | : base(ReplyStatus.UnknownLocalException, message) |
| | 237 | | { |
| | 238 | | } |
| | 239 | |
|
| | 240 | | /// <inheritdoc/> |
| | 241 | | public override string ice_id() => "::Ice::UnknownLocalException"; |
| | 242 | | } |
| | 243 | |
|
| | 244 | | /// <summary> |
| | 245 | | /// The dispatch returned a <see cref="UserException" /> that was not declared in the operation's exception |
| | 246 | | /// specification. |
| | 247 | | /// </summary> |
| | 248 | | /// <remarks>This exception is thrown by the generated code for Slice proxies. The server-side generated code does not |
| | 249 | | /// enforce the exception specifications of operations and as a result does not throw this exception.</remarks> |
| | 250 | | /// <remarks>This exception is equivalent to a <see cref="DispatchException" /> with reply status |
| | 251 | | /// <see cref="ReplyStatus.UnknownUserException"/>.</remarks> |
| | 252 | | public sealed class UnknownUserException : UnknownException |
| | 253 | | { |
| | 254 | | /// <summary> |
| | 255 | | /// Initializes a new instance of the <see cref="UnknownUserException" /> class from a user exception type ID. |
| | 256 | | /// </summary> |
| | 257 | | /// <param name="typeId">The type ID of the user exception.</param> |
| | 258 | | /// <returns>The new instance of the <see cref="UnknownUserException" /> class.</returns> |
| | 259 | | public static UnknownUserException fromTypeId(string typeId) => |
| | 260 | | new($"The reply carries a user exception that does not conform to the operation's exception specification: {type |
| | 261 | |
|
| | 262 | | /// <summary> |
| | 263 | | /// Initializes a new instance of the <see cref="UnknownUserException" /> class. |
| | 264 | | /// </summary> |
| | 265 | | /// <param name="message">The exception message.</param> |
| | 266 | | public UnknownUserException(string message) |
| | 267 | | : base(ReplyStatus.UnknownUserException, message) |
| | 268 | | { |
| | 269 | | } |
| | 270 | |
|
| | 271 | | /// <inheritdoc/> |
| | 272 | | public override string ice_id() => "::Ice::UnknownUserException"; |
| | 273 | | } |
| | 274 | |
|
| | 275 | | // |
| | 276 | | // Protocol exceptions |
| | 277 | | // |
| | 278 | |
|
| | 279 | | /// <summary> |
| | 280 | | /// The base class for Ice protocol exceptions. |
| | 281 | | /// </summary> |
| | 282 | | public class ProtocolException : LocalException |
| | 283 | | { |
| | 284 | | /// <summary> |
| | 285 | | /// Initializes a new instance of the <see cref="ProtocolException" /> class. |
| | 286 | | /// </summary> |
| | 287 | | /// <param name="message">The exception message.</param> |
| | 288 | | /// <param name="innerException">The inner exception.</param> |
| | 289 | | public ProtocolException(string message, System.Exception? innerException = null) |
| | 290 | | : base(message, innerException) |
| | 291 | | { |
| | 292 | | } |
| | 293 | |
|
| | 294 | | /// <inheritdoc/> |
| | 295 | | public override string ice_id() => "::Ice::ProtocolException"; |
| | 296 | | } |
| | 297 | |
|
| | 298 | | /// <summary> |
| | 299 | | /// This exception indicates that the connection has been gracefully closed by the server. |
| | 300 | | /// The operation call that caused this exception has not been executed by the server. In most cases you will not get |
| | 301 | | /// this exception because the client will automatically retry the operation call in case the server shut down the |
| | 302 | | /// connection. However, if upon retry the server shuts down the connection again, and the retry limit has been reached, |
| | 303 | | /// then this exception is propagated to the application code. |
| | 304 | | /// </summary> |
| | 305 | | public sealed class CloseConnectionException : ProtocolException |
| | 306 | | { |
| | 307 | | /// <summary> |
| | 308 | | /// Initializes a new instance of the <see cref="CloseConnectionException" /> class. |
| | 309 | | /// </summary> |
| | 310 | | public CloseConnectionException() |
| | 311 | | : base("Connection closed by the peer.") |
| | 312 | | { |
| | 313 | | } |
| | 314 | |
|
| | 315 | | /// <inheritdoc/> |
| | 316 | | public override string ice_id() => "::Ice::CloseConnectionException"; |
| | 317 | | } |
| | 318 | |
|
| | 319 | | /// <summary> |
| | 320 | | /// A datagram exceeds the configured size. |
| | 321 | | /// This exception is raised if a datagram exceeds the configured send or receive buffer size, or exceeds the maximum |
| | 322 | | /// payload size of a UDP packet (65507 bytes). |
| | 323 | | /// </summary> |
| | 324 | | public sealed class DatagramLimitException : ProtocolException |
| | 325 | | { |
| | 326 | | /// <summary> |
| | 327 | | /// Initializes a new instance of the <see cref="DatagramLimitException" /> class. |
| | 328 | | /// </summary> |
| | 329 | | public DatagramLimitException() |
| | 330 | | : base("Datagram limit exceeded.") |
| | 331 | | { |
| | 332 | | } |
| | 333 | |
|
| | 334 | | /// <inheritdoc/> |
| | 335 | | public override string ice_id() => "::Ice::DatagramLimitException"; |
| | 336 | | } |
| | 337 | |
|
| | 338 | | /// <summary> |
| | 339 | | /// This exception reports an error during marshaling or unmarshaling. |
| | 340 | | /// </summary> |
| | 341 | | public sealed class MarshalException : ProtocolException |
| | 342 | | { |
| | 343 | | /// <summary> |
| | 344 | | /// Initializes a new instance of the <see cref="MarshalException" /> class. |
| | 345 | | /// </summary> |
| | 346 | | /// <param name="message">The exception message.</param> |
| | 347 | | /// <param name="innerException">The inner exception.</param> |
| | 348 | | public MarshalException(string message, System.Exception? innerException = null) |
| | 349 | | : base(message, innerException) |
| | 350 | | { |
| | 351 | | } |
| | 352 | |
|
| | 353 | | /// <inheritdoc/> |
| | 354 | | public override string ice_id() => "::Ice::MarshalException"; |
| | 355 | | } |
| | 356 | |
|
| | 357 | | // |
| | 358 | | // Timeout exceptions |
| | 359 | | // |
| | 360 | |
|
| | 361 | | /// <summary>This exception indicates a timeout condition.</summary> |
| | 362 | | public class TimeoutException : LocalException |
| | 363 | | { |
| | 364 | | /// <summary> |
| | 365 | | /// Initializes a new instance of the <see cref="TimeoutException" /> class. |
| | 366 | | /// </summary> |
| | 367 | | /// <param name="message">The exception message or null to use the default message.</param> |
| | 368 | | public TimeoutException(string? message = null) |
| | 369 | | : base(message ?? "Operation timed out.") |
| | 370 | | { |
| | 371 | | } |
| | 372 | |
|
| | 373 | | /// <inheritdoc/> |
| | 374 | | public override string ice_id() => "::Ice::TimeoutException"; |
| | 375 | | } |
| | 376 | |
|
| | 377 | | /// <summary>This exception indicates a connection closure timeout condition.</summary> |
| | 378 | | public sealed class CloseTimeoutException : TimeoutException |
| | 379 | | { |
| | 380 | | /// <summary> |
| | 381 | | /// Initializes a new instance of the <see cref="CloseTimeoutException" /> class. |
| | 382 | | /// </summary> |
| | 383 | | public CloseTimeoutException() |
| | 384 | | : base("Close timed out.") |
| | 385 | | { |
| | 386 | | } |
| | 387 | |
|
| | 388 | | /// <inheritdoc/> |
| | 389 | | public override string ice_id() => "::Ice::CloseTimeoutException"; |
| | 390 | | } |
| | 391 | |
|
| | 392 | | /// <summary> |
| | 393 | | /// This exception indicates a connection establishment timeout condition. |
| | 394 | | /// </summary> |
| | 395 | | public sealed class ConnectTimeoutException : TimeoutException |
| | 396 | | { |
| | 397 | | /// <summary> |
| | 398 | | /// Initializes a new instance of the <see cref="ConnectTimeoutException" /> class. |
| | 399 | | /// </summary> |
| | 400 | | public ConnectTimeoutException() |
| | 401 | | : base("Connect timed out.") |
| | 402 | | { |
| | 403 | | } |
| | 404 | |
|
| | 405 | | /// <inheritdoc/> |
| | 406 | | public override string ice_id() => "::Ice::ConnectTimeoutException"; |
| | 407 | | } |
| | 408 | |
|
| | 409 | | /// <summary> |
| | 410 | | /// This exception indicates that an invocation failed because it timed out. |
| | 411 | | /// </summary> |
| | 412 | | public sealed class InvocationTimeoutException : TimeoutException |
| | 413 | | { |
| | 414 | | /// <summary> |
| | 415 | | /// Initializes a new instance of the <see cref="InvocationTimeoutException" /> class. |
| | 416 | | /// </summary> |
| | 417 | | public InvocationTimeoutException() |
| | 418 | | : base("Invocation timed out.") |
| | 419 | | { |
| | 420 | | } |
| | 421 | |
|
| | 422 | | /// <inheritdoc/> |
| | 423 | | public override string ice_id() => "::Ice::InvocationTimeoutException"; |
| | 424 | | } |
| | 425 | |
|
| | 426 | | // |
| | 427 | | // Syscall exceptions |
| | 428 | | // |
| | 429 | |
|
| | 430 | | /// <summary> |
| | 431 | | /// This exception is raised if a system error occurred in the server or client process. |
| | 432 | | /// </summary> |
| | 433 | | public class SyscallException : LocalException |
| | 434 | | { |
| | 435 | | /// <summary> |
| | 436 | | /// Initializes a new instance of the <see cref="SyscallException" /> class. |
| | 437 | | /// </summary> |
| | 438 | | /// <param name="message">The exception message.</param> |
| | 439 | | /// <param name="innerException">The inner exception.</param> |
| | 440 | | public SyscallException(string? message, System.Exception? innerException = null) |
| | 441 | | : base(message, innerException) |
| | 442 | | { |
| | 443 | | } |
| | 444 | |
|
| | 445 | | /// <summary> |
| | 446 | | /// Initializes a new instance of the <see cref="SyscallException" /> class. |
| | 447 | | /// </summary> |
| | 448 | | /// <param name="innerException">The inner exception.</param> |
| | 449 | | public SyscallException(System.Exception innerException) |
| | 450 | | : this(message: null, innerException) |
| | 451 | | { |
| | 452 | | } |
| | 453 | |
|
| | 454 | | /// <inheritdoc/> |
| | 455 | | public override string ice_id() => "::Ice::SyscallException"; |
| | 456 | | } |
| | 457 | |
|
| | 458 | | /// <summary> |
| | 459 | | /// This exception indicates a DNS problem. |
| | 460 | | /// </summary> |
| | 461 | | public sealed class DNSException : SyscallException |
| | 462 | | { |
| | 463 | | /// <summary> |
| | 464 | | /// Initializes a new instance of the <see cref="DNSException" /> class. |
| | 465 | | /// </summary> |
| | 466 | | /// <param name="host">The host name that could not be resolved.</param> |
| | 467 | | /// <param name="innerException">The inner exception.</param> |
| | 468 | | public DNSException(string host, System.Exception? innerException = null) |
| | 469 | | : base($"Cannot resolve host '{host}'", innerException) |
| | 470 | | { |
| | 471 | | } |
| | 472 | |
|
| | 473 | | /// <inheritdoc/> |
| | 474 | | public override string ice_id() => "::Ice::DNSException"; |
| | 475 | | } |
| | 476 | |
|
| | 477 | | /// <summary>This exception indicates a file error occurred.</summary> |
| | 478 | | public sealed class FileException : SyscallException |
| | 479 | | { |
| | 480 | | /// <summary> |
| | 481 | | /// Initializes a new instance of the <see cref="FileException" /> class. |
| | 482 | | /// </summary> |
| | 483 | | /// <param name="message">The exception message.</param> |
| | 484 | | /// <param name="innerException">The inner exception.</param> |
| | 485 | | public FileException(string message, System.Exception innerException) |
| | 486 | | : base(message, innerException) |
| | 487 | | { |
| | 488 | | } |
| | 489 | |
|
| | 490 | | /// <inheritdoc/> |
| | 491 | | public override string ice_id() => "::Ice::FileException"; |
| | 492 | | } |
| | 493 | |
|
| | 494 | | // |
| | 495 | | // Socket exceptions |
| | 496 | | // |
| | 497 | |
|
| | 498 | | /// <summary> |
| | 499 | | /// This exception indicates a socket error. |
| | 500 | | /// </summary> |
| | 501 | | public class SocketException : SyscallException |
| | 502 | | { |
| | 503 | | /// <summary> |
| | 504 | | /// Initializes a new instance of the <see cref="SocketException" /> class. |
| | 505 | | /// </summary> |
| | 506 | | /// <param name="innerException">The inner exception.</param> |
| | 507 | | public SocketException(System.Exception? innerException = null) |
| | 508 | | : base(message: null, innerException) |
| | 509 | | { |
| | 510 | | } |
| | 511 | |
|
| | 512 | | /// <inheritdoc/> |
| | 513 | | public override string ice_id() => "::Ice::SocketException"; |
| | 514 | | } |
| | 515 | |
|
| | 516 | | /// <summary> |
| | 517 | | /// This exception indicates a connection failure. |
| | 518 | | /// </summary> |
| | 519 | | public class ConnectFailedException : SocketException |
| | 520 | | { |
| | 521 | | /// <summary> |
| | 522 | | /// Initializes a new instance of the <see cref="ConnectFailedException" /> class. |
| | 523 | | /// </summary> |
| | 524 | | /// <param name="innerException">The inner exception.</param> |
| | 525 | | public ConnectFailedException(System.Exception? innerException = null) |
| | 526 | | : base(innerException) |
| | 527 | | { |
| | 528 | | } |
| | 529 | |
|
| | 530 | | /// <inheritdoc/> |
| | 531 | | public override string ice_id() => "::Ice::ConnectFailedException"; |
| | 532 | | } |
| | 533 | |
|
| | 534 | | /// <summary> |
| | 535 | | /// This exception indicates a lost connection. |
| | 536 | | /// </summary> |
| | 537 | | public sealed class ConnectionLostException : SocketException |
| | 538 | | { |
| | 539 | | /// <summary> |
| | 540 | | /// Initializes a new instance of the <see cref="ConnectionLostException" /> class. |
| | 541 | | /// </summary> |
| | 542 | | /// <param name="innerException">The inner exception.</param> |
| | 543 | | public ConnectionLostException(System.Exception? innerException = null) |
| | 544 | | : base(innerException) |
| | 545 | | { |
| | 546 | | } |
| | 547 | |
|
| | 548 | | /// <inheritdoc/> |
| | 549 | | public override string ice_id() => "::Ice::ConnectionLostException"; |
| | 550 | | } |
| | 551 | |
|
| | 552 | | /// <summary> |
| | 553 | | /// This exception indicates a connection failure for which the server host actively refuses a connection. |
| | 554 | | /// </summary> |
| | 555 | | public sealed class ConnectionRefusedException : ConnectFailedException |
| | 556 | | { |
| | 557 | | /// <summary> |
| | 558 | | /// Initializes a new instance of the <see cref="ConnectionRefusedException" /> class. |
| | 559 | | /// </summary> |
| | 560 | | /// <param name="innerException">The inner exception.</param> |
| | 561 | | public ConnectionRefusedException(System.Exception? innerException = null) |
| | 562 | | : base(innerException) |
| | 563 | | { |
| | 564 | | } |
| | 565 | |
|
| | 566 | | /// <inheritdoc/> |
| | 567 | | public override string ice_id() => "::Ice::ConnectionRefusedException"; |
| | 568 | | } |
| | 569 | |
|
| | 570 | | // |
| | 571 | | // Other leaf local exceptions in alphabetical order. |
| | 572 | | // |
| | 573 | |
|
| | 574 | | /// <summary> |
| | 575 | | /// An attempt was made to register something more than once with the Ice run time. |
| | 576 | | /// This exception is raised if an attempt is made to register a servant, servant locator, facet, object adapter (etc.) |
| | 577 | | /// more than once for the same ID. |
| | 578 | | /// </summary> |
| | 579 | | public sealed class AlreadyRegisteredException : LocalException |
| | 580 | | { |
| | 581 | | /// <summary> |
| | 582 | | /// Gets the kind of object that was already registered. |
| | 583 | | /// </summary> |
| | 584 | | public string kindOfObject { get; } |
| | 585 | |
|
| | 586 | | /// <summary> |
| | 587 | | /// Gets the ID or name of the object that was already registered. |
| | 588 | | /// </summary> |
| | 589 | | public string id { get; } |
| | 590 | |
|
| | 591 | | /// <summary> |
| | 592 | | /// Initializes a new instance of the <see cref="AlreadyRegisteredException" /> class. |
| | 593 | | /// </summary> |
| | 594 | | /// <param name="kindOfObject">The kind of object that was already registered.</param> |
| | 595 | | /// <param name="id">The ID or name of the object that was already registered.</param> |
| | 596 | | public AlreadyRegisteredException(string kindOfObject, string id) |
| | 597 | | : base($"Another {kindOfObject} is already registered with ID '{id}'.") |
| | 598 | | { |
| | 599 | | this.kindOfObject = kindOfObject; |
| | 600 | | this.id = id; |
| | 601 | | } |
| | 602 | |
|
| | 603 | | /// <inheritdoc/> |
| | 604 | | public override string ice_id() => "::Ice::AlreadyRegisteredException"; |
| | 605 | | } |
| | 606 | |
|
| | 607 | | /// <summary> |
| | 608 | | /// This exception is raised if the Communicator has been destroyed. |
| | 609 | | /// </summary> |
| | 610 | | public sealed class CommunicatorDestroyedException : LocalException |
| | 611 | | { |
| | 612 | | /// <summary> |
| | 613 | | /// Initializes a new instance of the <see cref="CommunicatorDestroyedException" /> class. |
| | 614 | | /// </summary> |
| | 615 | | public CommunicatorDestroyedException() |
| | 616 | | : base("Communicator destroyed.") |
| | 617 | | { |
| | 618 | | } |
| | 619 | |
|
| | 620 | | /// <inheritdoc/> |
| | 621 | | public override string ice_id() => "::Ice::CommunicatorDestroyedException"; |
| | 622 | | } |
| | 623 | |
|
| | 624 | | /// <summary> |
| | 625 | | /// This exception indicates that a connection was closed forcefully. |
| | 626 | | /// </summary> |
| | 627 | | public sealed class ConnectionAbortedException : LocalException |
| | 628 | | { |
| | 629 | | /// <summary> |
| | 630 | | /// Gets a value indicating whether the connection was aborted by the application. |
| | 631 | | /// </summary> |
| | 632 | | /// <value><c>true</c> if the connection was aborted by the application; otherwise, <c>false</c>.</value> |
| | 633 | | public bool closedByApplication { get; } |
| | 634 | |
|
| | 635 | | /// <summary> |
| | 636 | | /// Initializes a new instance of the <see cref="ConnectionAbortedException" /> class. |
| | 637 | | /// </summary> |
| | 638 | | /// <param name="message">The exception message.</param> |
| | 639 | | /// <param name="closedByApplication">A value indicating whether the connection was aborted by the application. |
| | 640 | | /// </param> |
| | 641 | | public ConnectionAbortedException(string message, bool closedByApplication) |
| | 642 | | : base(message) => |
| | 643 | | this.closedByApplication = closedByApplication; |
| | 644 | |
|
| | 645 | | /// <inheritdoc/> |
| | 646 | | public override string ice_id() => "::Ice::ConnectionAbortedException"; |
| | 647 | | } |
| | 648 | |
|
| | 649 | | /// <summary> |
| | 650 | | /// This exception indicates that a connection was closed gracefully. |
| | 651 | | /// </summary> |
| | 652 | | public sealed class ConnectionClosedException : LocalException |
| | 653 | | { |
| | 654 | | /// <summary> |
| | 655 | | /// Gets a value indicating whether the connection was closed by the application. |
| | 656 | | /// </summary> |
| | 657 | | /// <value><c>true</c> if the connection was closed by the application; otherwise, <c>false</c>.</value> |
| | 658 | | public bool closedByApplication { get; } |
| | 659 | |
|
| | 660 | | /// <summary> |
| | 661 | | /// Initializes a new instance of the <see cref="ConnectionClosedException" /> class. |
| | 662 | | /// </summary> |
| | 663 | | /// <param name="message">The exception message.</param> |
| | 664 | | /// <param name="closedByApplication">A value indicating whether the connection was closed by the application. |
| | 665 | | /// </param> |
| | 666 | | public ConnectionClosedException(string message, bool closedByApplication) |
| | 667 | | : base(message) => |
| | 668 | | this.closedByApplication = closedByApplication; |
| | 669 | |
|
| | 670 | | /// <inheritdoc/> |
| | 671 | | public override string ice_id() => "::Ice::ConnectionClosedException"; |
| | 672 | | } |
| | 673 | |
|
| | 674 | | /// <summary> |
| | 675 | | /// This exception is raised if an unsupported feature is used. |
| | 676 | | /// </summary> |
| | 677 | | public sealed class FeatureNotSupportedException : LocalException |
| | 678 | | { |
| | 679 | | /// <summary> |
| | 680 | | /// Initializes a new instance of the <see cref="FeatureNotSupportedException" /> class. |
| | 681 | | /// </summary> |
| | 682 | | /// <param name="message">The exception message.</param> |
| | 683 | | public FeatureNotSupportedException(string message) |
| 1 | 684 | | : base(message) |
| | 685 | | { |
| 1 | 686 | | } |
| | 687 | |
|
| | 688 | | /// <inheritdoc/> |
| 0 | 689 | | public override string ice_id() => "::Ice::FeatureNotSupportedException"; |
| | 690 | | } |
| | 691 | |
|
| | 692 | | /// <summary> |
| | 693 | | /// This exception indicates that an attempt has been made to change the connection properties of a fixed proxy. |
| | 694 | | /// </summary> |
| | 695 | | public sealed class FixedProxyException : LocalException |
| | 696 | | { |
| | 697 | | /// <summary> |
| | 698 | | /// Initializes a new instance of the <see cref="FixedProxyException" /> class. |
| | 699 | | /// </summary> |
| | 700 | | public FixedProxyException() |
| | 701 | | : base("Cannot change the connection properties of a fixed proxy.") |
| | 702 | | { |
| | 703 | | } |
| | 704 | |
|
| | 705 | | /// <inheritdoc/> |
| | 706 | | public override string ice_id() => "::Ice::FixedProxyException"; |
| | 707 | | } |
| | 708 | |
|
| | 709 | | /// <summary> |
| | 710 | | /// This exception is raised when a failure occurs during initialization. |
| | 711 | | /// </summary> |
| | 712 | | public sealed class InitializationException : LocalException |
| | 713 | | { |
| | 714 | | /// <summary> |
| | 715 | | /// Initializes a new instance of the <see cref="InitializationException" /> class. |
| | 716 | | /// </summary> |
| | 717 | | /// <param name="message">The exception message.</param> |
| | 718 | | /// <param name="innerException">The inner exception.</param> |
| | 719 | | public InitializationException(string message, System.Exception? innerException = null) |
| | 720 | | : base(message, innerException) |
| | 721 | | { |
| | 722 | | } |
| | 723 | |
|
| | 724 | | /// <inheritdoc/> |
| | 725 | | public override string ice_id() => "::Ice::InitializationException"; |
| | 726 | | } |
| | 727 | |
|
| | 728 | | /// <summary> |
| | 729 | | /// This exception indicates that an asynchronous invocation failed because it was canceled explicitly by the user. |
| | 730 | | /// </summary> |
| | 731 | | public sealed class InvocationCanceledException : LocalException |
| | 732 | | { |
| | 733 | | /// <summary> |
| | 734 | | /// Initializes a new instance of the <see cref="InvocationCanceledException" /> class. |
| | 735 | | /// </summary> |
| | 736 | | public InvocationCanceledException() |
| | 737 | | : base("Invocation canceled.") |
| | 738 | | { |
| | 739 | | } |
| | 740 | |
|
| | 741 | | /// <inheritdoc/> |
| | 742 | | public override string ice_id() => "::Ice::InvocationCanceledException"; |
| | 743 | | } |
| | 744 | |
|
| | 745 | | /// <summary> |
| | 746 | | /// This exception is raised if no suitable endpoint is available. |
| | 747 | | /// </summary> |
| | 748 | | public sealed class NoEndpointException : LocalException |
| | 749 | | { |
| | 750 | | /// <summary> |
| | 751 | | /// Initializes a new instance of the <see cref="NoEndpointException" /> class. |
| | 752 | | /// </summary> |
| | 753 | | /// <param name="message">The exception message.</param> |
| | 754 | | public NoEndpointException(string message) |
| | 755 | | : base(message) |
| | 756 | | { |
| | 757 | | } |
| | 758 | |
|
| | 759 | | /// <summary> |
| | 760 | | /// Initializes a new instance of the <see cref="NoEndpointException" /> class. |
| | 761 | | /// </summary> |
| | 762 | | /// <param name="proxy">The proxy for which no suitable endpoint is available.</param> |
| | 763 | | public NoEndpointException(ObjectPrx proxy) |
| | 764 | | : base($"No suitable endpoint available for proxy '{proxy}'.") |
| | 765 | | { |
| | 766 | | } |
| | 767 | |
|
| | 768 | | /// <inheritdoc/> |
| | 769 | | public override string ice_id() => "::Ice::NoEndpointException"; |
| | 770 | | } |
| | 771 | |
|
| | 772 | | /// <summary> |
| | 773 | | /// An attempt was made to find or deregister something that is not registered with Ice. |
| | 774 | | /// </summary> |
| | 775 | | public sealed class NotRegisteredException : LocalException |
| | 776 | | { |
| | 777 | | /// <summary> |
| | 778 | | /// Gets the kind of object that is not registered. |
| | 779 | | /// </summary> |
| | 780 | | public string kindOfObject { get; } |
| | 781 | |
|
| | 782 | | /// <summary> |
| | 783 | | /// Gets the ID or name of the object that is not registered. |
| | 784 | | /// </summary> |
| | 785 | | public string id { get; } |
| | 786 | |
|
| | 787 | | /// <summary> |
| | 788 | | /// Initializes a new instance of the <see cref="NotRegisteredException" /> class. |
| | 789 | | /// </summary> |
| | 790 | | /// <param name="kindOfObject">The kind of object that is not registered.</param> |
| | 791 | | /// <param name="id">The ID or name of the object that is not registered.</param> |
| | 792 | | public NotRegisteredException(string kindOfObject, string id) |
| | 793 | | : base($"No {kindOfObject} is registered with ID '{id}'.") |
| | 794 | | { |
| | 795 | | this.kindOfObject = kindOfObject; |
| | 796 | | this.id = id; |
| | 797 | | } |
| | 798 | |
|
| | 799 | | /// <inheritdoc/> |
| | 800 | | public override string ice_id() => "::Ice::NotRegisteredException"; |
| | 801 | | } |
| | 802 | |
|
| | 803 | | /// <summary> |
| | 804 | | /// This exception is raised if an attempt is made to use a deactivated ObjectAdapter. |
| | 805 | | /// </summary> |
| | 806 | | public sealed class ObjectAdapterDeactivatedException : LocalException |
| | 807 | | { |
| | 808 | | /// <summary> |
| | 809 | | /// Initializes a new instance of the <see cref="ObjectAdapterDeactivatedException" /> class. |
| | 810 | | /// </summary> |
| | 811 | | /// <param name="name">The name of the object adapter that is deactivated.</param> |
| | 812 | | public ObjectAdapterDeactivatedException(string name) |
| | 813 | | : base($"Object adapter '{name}' is deactivated.") |
| | 814 | | { |
| | 815 | | } |
| | 816 | |
|
| | 817 | | /// <inheritdoc/> |
| | 818 | | public override string ice_id() => "::Ice::ObjectAdapterDeactivatedException"; |
| | 819 | | } |
| | 820 | |
|
| | 821 | | /// <summary> |
| | 822 | | /// This exception is raised if an attempt is made to use a destroyed ObjectAdapter. |
| | 823 | | /// </summary> |
| | 824 | | public sealed class ObjectAdapterDestroyedException : LocalException |
| | 825 | | { |
| | 826 | | /// <summary> |
| | 827 | | /// Initializes a new instance of the <see cref="ObjectAdapterDestroyedException" /> class. |
| | 828 | | /// </summary> |
| | 829 | | /// <param name="name">The name of the object adapter that is destroyed.</param> |
| | 830 | | public ObjectAdapterDestroyedException(string name) |
| | 831 | | : base($"Object adapter '{name}' is destroyed.") |
| | 832 | | { |
| | 833 | | } |
| | 834 | |
|
| | 835 | | /// <inheritdoc/> |
| | 836 | | public override string ice_id() => "::Ice::ObjectAdapterDestroyedException"; |
| | 837 | | } |
| | 838 | |
|
| | 839 | | /// <summary> |
| | 840 | | /// This exception is raised if an ObjectAdapter cannot be activated. |
| | 841 | | /// This happens if the Locator detects another active ObjectAdapter with the same adapter ID. |
| | 842 | | /// </summary> |
| | 843 | | public sealed class ObjectAdapterIdInUseException : LocalException |
| | 844 | | { |
| | 845 | | /// <summary> |
| | 846 | | /// Initializes a new instance of the <see cref="ObjectAdapterIdInUseException" /> class. |
| | 847 | | /// </summary> |
| | 848 | | /// <param name="adapterId">The adapter ID that is already in use.</param> |
| | 849 | | public ObjectAdapterIdInUseException(string adapterId) |
| | 850 | | : base($"An object adapter with adapter ID '{adapterId}' is already active.") |
| | 851 | | { |
| | 852 | | } |
| | 853 | |
|
| | 854 | | /// <inheritdoc/> |
| | 855 | | public override string ice_id() => "::Ice::ObjectAdapterIdInUseException"; |
| | 856 | | } |
| | 857 | |
|
| | 858 | | /// <summary> |
| | 859 | | /// Reports a failure that occurred while parsing a string. |
| | 860 | | /// </summary> |
| | 861 | | public sealed class ParseException : LocalException |
| | 862 | | { |
| | 863 | | /// <summary> |
| | 864 | | /// Initializes a new instance of the <see cref="ParseException" /> class. |
| | 865 | | /// </summary> |
| | 866 | | /// <param name="message">The exception message.</param> |
| | 867 | | /// <param name="innerException">The inner exception.</param> |
| | 868 | | public ParseException(string message, System.Exception? innerException = null) |
| | 869 | | : base(message, innerException) |
| | 870 | | { |
| | 871 | | } |
| | 872 | |
|
| | 873 | | /// <inheritdoc/> |
| | 874 | | public override string ice_id() => "::Ice::ParseException"; |
| | 875 | | } |
| | 876 | |
|
| | 877 | | /// <summary> |
| | 878 | | /// This exception indicates that a failure occurred while initializing a plug-in. |
| | 879 | | /// </summary> |
| | 880 | | public sealed class PluginInitializationException : LocalException |
| | 881 | | { |
| | 882 | | /// <summary> |
| | 883 | | /// Initializes a new instance of the <see cref="PluginInitializationException" /> class. |
| | 884 | | /// </summary> |
| | 885 | | /// <param name="message">The exception message.</param> |
| | 886 | | /// <param name="innerException">The inner exception.</param> |
| | 887 | | public PluginInitializationException(string message, System.Exception? innerException = null) |
| | 888 | | : base(message, innerException) |
| | 889 | | { |
| | 890 | | } |
| | 891 | |
|
| | 892 | | /// <inheritdoc/> |
| | 893 | | public override string ice_id() => "::Ice::PluginInitializationException"; |
| | 894 | | } |
| | 895 | |
|
| | 896 | | /// <summary> |
| | 897 | | /// This exception indicates a failure in a security subsystem. |
| | 898 | | /// </summary> |
| | 899 | | public sealed class SecurityException : LocalException |
| | 900 | | { |
| | 901 | | /// <summary> |
| | 902 | | /// Initializes a new instance of the <see cref="SecurityException" /> class. |
| | 903 | | /// </summary> |
| | 904 | | /// <param name="message">The exception message.</param> |
| | 905 | | /// <param name="innerException">The inner exception.</param> |
| | 906 | | public SecurityException(string message, System.Exception? innerException = null) |
| | 907 | | : base(message, innerException) |
| | 908 | | { |
| | 909 | | } |
| | 910 | |
|
| | 911 | | /// <inheritdoc/> |
| | 912 | | public override string ice_id() => "::Ice::SecurityException"; |
| | 913 | | } |
| | 914 | |
|
| | 915 | | /// <summary> |
| | 916 | | /// The operation can only be invoked with a two-way request. |
| | 917 | | /// This exception is raised if an attempt is made to invoke an operation with ice_oneway, ice_batchOneway, |
| | 918 | | /// ice_datagram, or ice_batchDatagram and the operation has a return value, out-parameters, or an exception |
| | 919 | | /// specification. |
| | 920 | | /// </summary> |
| | 921 | | public sealed class TwowayOnlyException : LocalException |
| | 922 | | { |
| | 923 | | /// <summary> |
| | 924 | | /// Initializes a new instance of the <see cref="TwowayOnlyException" /> class. |
| | 925 | | /// </summary> |
| | 926 | | /// <param name="operation">The operation name.</param> |
| | 927 | | public TwowayOnlyException(string operation) |
| | 928 | | : base($"Cannot invoke operation '{operation}' with a oneway, batchOneway, datagram, or batchDatagram proxy.") |
| | 929 | | { |
| | 930 | | } |
| | 931 | |
|
| | 932 | | public override string ice_id() => "::Ice::TwowayOnlyException"; |
| | 933 | | } |
| | 934 | |
|
| | 935 | | /// <summary> |
| | 936 | | /// This exception is raised when there is an error while getting or setting a property. For example, when |
| | 937 | | /// trying to set an unknown Ice property. |
| | 938 | | /// </summary> |
| | 939 | | public sealed class PropertyException : LocalException |
| | 940 | | { |
| | 941 | | /// <summary> |
| | 942 | | /// Initializes a new instance of the <see cref="PropertyException" /> class. |
| | 943 | | /// </summary> |
| | 944 | | /// <param name="message">The exception message.</param> |
| | 945 | | /// <param name="innerException">The inner exception.</param> |
| | 946 | | public PropertyException(string message, System.Exception? innerException = null) |
| | 947 | | : base(message, innerException) |
| | 948 | | { |
| | 949 | | } |
| | 950 | |
|
| | 951 | | /// <inheritdoc/> |
| | 952 | | public override string ice_id() => "::Ice::PropertyException"; |
| | 953 | | } |