| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Data |
| 4 | { |
| 5 | using System; |
| 6 | |
| 7 | /// <summary> |
| 8 | /// Base class for all WiX exceptions. |
| 9 | /// </summary> |
| 10 | [Serializable] |
| 11 | public class WixException : Exception |
| 12 | { |
| 13 | /// <summary> |
| 14 | /// Instantiate a new WixException. |
| 15 | /// </summary> |
| 16 | public WixException() |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | /// <summary> |
| 21 | /// Instantiate a new WixException with a simple string message. |
| 22 | /// </summary> |
| 23 | /// <param name="message">Simple string message.</param> |
| 24 | public WixException(string message) : base(message) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | /// <summary> |
| 29 | /// Instantiate a new WixException with a simple message and exception. |
| 30 | /// </summary> |
| 31 | /// <param name="message">Simple string message.</param> |
| 32 | /// <param name="innerException">Inner exception.</param> |
| 33 | public WixException(string message, Exception innerException) : base(message, innerException) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | /// <summary> |
| 38 | /// Instantiate a new WixException with a given WixError. |
| 39 | /// </summary> |
| 40 | /// <param name="error">The localized error information.</param> |
| 41 | public WixException(Message error) |
| 42 | : this(error, null) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | /// <summary> |
| 47 | /// Instantiate a new WixException with a given WixError. |
| 48 | /// </summary> |
| 49 | /// <param name="error">The localized error information.</param> |
| 50 | /// <param name="exception">Original exception.</param> |
| 51 | public WixException(Message error, Exception exception) : |
| 52 | base(error.ToString(), exception) |
| 53 | { |
| 54 | this.Error = error; |
| 55 | } |
| 56 | |
| 57 | /// <summary> |
| 58 | /// Gets the error message. |
| 59 | /// </summary> |
| 60 | /// <value>The error message.</value> |
| 61 | public Message Error { get; } |
| 62 | } |
| 63 | } |