| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | namespace IceRpc.Internal; |
| | | 4 | | |
| | | 5 | | /// <summary>Provides a helper method to compose the error message of a failure response.</summary> |
| | | 6 | | internal static class DispatchErrorMessage |
| | | 7 | | { |
| | | 8 | | /// <summary>Composes the error message of a failure response.</summary> |
| | | 9 | | /// <param name="message">The message that describes the failure.</param> |
| | | 10 | | /// <param name="exception">The exception that is the cause of the failure, or <see langword="null" /> when the |
| | | 11 | | /// failure was not caused by an exception.</param> |
| | | 12 | | /// <returns><paramref name="message" /> when <paramref name="exception" /> is <see langword="null" />; otherwise, |
| | | 13 | | /// <paramref name="message" /> followed by the type and the message of <paramref name="exception" />.</returns> |
| | | 14 | | internal static string Compose(string message, Exception? exception) => |
| | 150 | 15 | | exception is null ? |
| | 150 | 16 | | message : |
| | 150 | 17 | | $"{message} The failure was caused by an exception of type '{exception.GetType()}' with message: {exception. |
| | | 18 | | } |