| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace IceRpc; |
| | 4 | |
|
| | 5 | | /// <summary>The IceRPC core and built-in invokers, dispatchers (including built-in middleware and interceptors) report |
| | 6 | | /// errors by throwing this exception.</summary> |
| | 7 | | public class IceRpcException : IOException |
| | 8 | | { |
| | 9 | | /// <summary>Gets the IceRpc error.</summary> |
| | 10 | | /// <value>The <see cref="IceRpcError.IceRpcError"/> of this exception.</value> |
| 670 | 11 | | public IceRpcError IceRpcError { get; } |
| | 12 | |
|
| | 13 | | /// <summary>Constructs a new instance of the <see cref="IceRpcException" /> class.</summary> |
| | 14 | | /// <param name="error">The error.</param> |
| | 15 | | /// <param name="message">A message that describes the exception.</param> |
| | 16 | | /// <param name="innerException">The exception that caused this exception.</param> |
| | 17 | | public IceRpcException(IceRpcError error, string? message, Exception? innerException = null) |
| 6906 | 18 | | : base(message ?? $"An IceRpc call failed with error '{error}'.", innerException) => |
| 6906 | 19 | | IceRpcError = error; |
| | 20 | |
|
| | 21 | | /// <summary>Constructs a new instance of the <see cref="IceRpcException" /> class.</summary> |
| | 22 | | /// <param name="error">The error.</param> |
| | 23 | | /// <param name="innerException">The exception that caused this exception.</param> |
| | 24 | | public IceRpcException(IceRpcError error, Exception? innerException = null) |
| 5721 | 25 | | : this(error, message: null, innerException) |
| 5721 | 26 | | { |
| 5721 | 27 | | } |
| | 28 | | } |