| | 1 | | // Copyright (c) Microsoft. All rights reserved. |
| | 2 | | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| | 3 | |
|
| | 4 | | namespace Microsoft.Azure.ServiceBus.Primitives |
| | 5 | | { |
| | 6 | | using System; |
| | 7 | |
|
| | 8 | | class ExceptionUtility |
| | 9 | | { |
| | 10 | | public ArgumentException Argument(string paramName, string message) |
| | 11 | | { |
| 8 | 12 | | return new ArgumentException(message, paramName); |
| | 13 | | } |
| | 14 | |
|
| | 15 | | public Exception ArgumentNull(string paramName) |
| | 16 | | { |
| 0 | 17 | | return new ArgumentNullException(paramName); |
| | 18 | | } |
| | 19 | |
|
| | 20 | | public ArgumentException ArgumentNullOrWhiteSpace(string paramName) |
| | 21 | | { |
| 0 | 22 | | return this.Argument(paramName, Resources.ArgumentNullOrWhiteSpace.FormatForUser(paramName)); |
| | 23 | | } |
| | 24 | |
|
| | 25 | | public ArgumentOutOfRangeException ArgumentOutOfRange(string paramName, object actualValue, string message) |
| | 26 | | { |
| 0 | 27 | | return new ArgumentOutOfRangeException(paramName, actualValue, message); |
| | 28 | | } |
| | 29 | |
|
| | 30 | | public Exception AsError(Exception exception) |
| | 31 | | { |
| 0 | 32 | | return exception; |
| | 33 | | } |
| | 34 | | } |
| | 35 | | } |