| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace IceRpc.Internal; |
| | 4 | |
|
| | 5 | | internal static class DispatchExceptionExtensions |
| | 6 | | { |
| | 7 | | /// <summary>Creates an outgoing response from this dispatch exception.</summary> |
| | 8 | | /// <param name="exception">The dispatch exception.</param> |
| | 9 | | /// <param name="request">The incoming request.</param> |
| | 10 | | /// <returns>The outgoing response.</returns> |
| | 11 | | internal static OutgoingResponse ToOutgoingResponse(this DispatchException exception, IncomingRequest request) |
| 34 | 12 | | { |
| 34 | 13 | | if (exception.ConvertToInternalError) |
| 0 | 14 | | { |
| 0 | 15 | | return new OutgoingResponse(request, StatusCode.InternalError, message: null, exception); |
| | 16 | | } |
| | 17 | | else |
| 34 | 18 | | { |
| 34 | 19 | | return new OutgoingResponse(request, exception.StatusCode, exception.Message, exception.InnerException); |
| | 20 | | } |
| 34 | 21 | | } |
| | 22 | | } |