diff options
Diffstat (limited to 'src/WixToolset.Mba.Core/Exceptions.cs')
| -rw-r--r-- | src/WixToolset.Mba.Core/Exceptions.cs | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/src/WixToolset.Mba.Core/Exceptions.cs b/src/WixToolset.Mba.Core/Exceptions.cs new file mode 100644 index 00000000..360b360d --- /dev/null +++ b/src/WixToolset.Mba.Core/Exceptions.cs | |||
| @@ -0,0 +1,145 @@ | |||
| 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.BootstrapperCore | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Runtime.Serialization; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// Base class for exception returned to the bootstrapper application host. | ||
| 10 | /// </summary> | ||
| 11 | [Serializable] | ||
| 12 | public abstract class BootstrapperException : Exception | ||
| 13 | { | ||
| 14 | /// <summary> | ||
| 15 | /// Creates an instance of the <see cref="BootstrapperException"/> base class with the given HRESULT. | ||
| 16 | /// </summary> | ||
| 17 | /// <param name="hr">The HRESULT for the exception that is used by the bootstrapper application host.</param> | ||
| 18 | public BootstrapperException(int hr) | ||
| 19 | { | ||
| 20 | this.HResult = hr; | ||
| 21 | } | ||
| 22 | |||
| 23 | /// <summary> | ||
| 24 | /// Initializes a new instance of the <see cref="BootstrapperException"/> class. | ||
| 25 | /// </summary> | ||
| 26 | /// <param name="message">Exception message.</param> | ||
| 27 | public BootstrapperException(string message) | ||
| 28 | : base(message) | ||
| 29 | { | ||
| 30 | } | ||
| 31 | |||
| 32 | /// <summary> | ||
| 33 | /// Initializes a new instance of the <see cref="BootstrapperException"/> class. | ||
| 34 | /// </summary> | ||
| 35 | /// <param name="message">Exception message</param> | ||
| 36 | /// <param name="innerException">Inner exception associated with this one</param> | ||
| 37 | public BootstrapperException(string message, Exception innerException) | ||
| 38 | : base(message, innerException) | ||
| 39 | { | ||
| 40 | } | ||
| 41 | |||
| 42 | /// <summary> | ||
| 43 | /// Initializes a new instance of the <see cref="BootstrapperException"/> class. | ||
| 44 | /// </summary> | ||
| 45 | /// <param name="info">Serialization information for this exception</param> | ||
| 46 | /// <param name="context">Streaming context to serialize to</param> | ||
| 47 | protected BootstrapperException(SerializationInfo info, StreamingContext context) | ||
| 48 | : base(info, context) | ||
| 49 | { | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | /// <summary> | ||
| 54 | /// The bootstrapper application assembly loaded by the host does not contain exactly one instance of the | ||
| 55 | /// <see cref="BootstrapperApplicationFactoryAttribute"/> class. | ||
| 56 | /// </summary> | ||
| 57 | /// <seealso cref="BootstrapperApplicationFactoryAttribute"/> | ||
| 58 | [Serializable] | ||
| 59 | public class MissingAttributeException : BootstrapperException | ||
| 60 | { | ||
| 61 | /// <summary> | ||
| 62 | /// Creates a new instance of the <see cref="MissingAttributeException"/> class. | ||
| 63 | /// </summary> | ||
| 64 | public MissingAttributeException() | ||
| 65 | : base(NativeMethods.E_NOTFOUND) | ||
| 66 | { | ||
| 67 | } | ||
| 68 | |||
| 69 | /// <summary> | ||
| 70 | /// Initializes a new instance of the <see cref="MissingAttributeException"/> class. | ||
| 71 | /// </summary> | ||
| 72 | /// <param name="message">Exception message.</param> | ||
| 73 | public MissingAttributeException(string message) | ||
| 74 | : base(message) | ||
| 75 | { | ||
| 76 | } | ||
| 77 | |||
| 78 | /// <summary> | ||
| 79 | /// Initializes a new instance of the <see cref="MissingAttributeException"/> class. | ||
| 80 | /// </summary> | ||
| 81 | /// <param name="message">Exception message</param> | ||
| 82 | /// <param name="innerException">Inner exception associated with this one</param> | ||
| 83 | public MissingAttributeException(string message, Exception innerException) | ||
| 84 | : base(message, innerException) | ||
| 85 | { | ||
| 86 | } | ||
| 87 | |||
| 88 | /// <summary> | ||
| 89 | /// Initializes a new instance of the <see cref="MissingAttributeException"/> class. | ||
| 90 | /// </summary> | ||
| 91 | /// <param name="info">Serialization information for this exception</param> | ||
| 92 | /// <param name="context">Streaming context to serialize to</param> | ||
| 93 | protected MissingAttributeException(SerializationInfo info, StreamingContext context) | ||
| 94 | : base(info, context) | ||
| 95 | { | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | /// <summary> | ||
| 100 | /// The bootstrapper application factory specified by the <see cref="BootstrapperApplicationFactoryAttribute"/> | ||
| 101 | /// does not extend the <see cref="IBootstrapperApplicationFactory"/> base class. | ||
| 102 | /// </summary> | ||
| 103 | /// <seealso cref="BaseBootstrapperApplicationFactory"/> | ||
| 104 | /// <seealso cref="BootstrapperApplicationFactoryAttribute"/> | ||
| 105 | [Serializable] | ||
| 106 | public class InvalidBootstrapperApplicationFactoryException : BootstrapperException | ||
| 107 | { | ||
| 108 | /// <summary> | ||
| 109 | /// Creates a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class. | ||
| 110 | /// </summary> | ||
| 111 | public InvalidBootstrapperApplicationFactoryException() | ||
| 112 | : base(NativeMethods.E_UNEXPECTED) | ||
| 113 | { | ||
| 114 | } | ||
| 115 | |||
| 116 | /// <summary> | ||
| 117 | /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class. | ||
| 118 | /// </summary> | ||
| 119 | /// <param name="message">Exception message.</param> | ||
| 120 | public InvalidBootstrapperApplicationFactoryException(string message) | ||
| 121 | : base(message) | ||
| 122 | { | ||
| 123 | } | ||
| 124 | |||
| 125 | /// <summary> | ||
| 126 | /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class. | ||
| 127 | /// </summary> | ||
| 128 | /// <param name="message">Exception message</param> | ||
| 129 | /// <param name="innerException">Inner exception associated with this one</param> | ||
| 130 | public InvalidBootstrapperApplicationFactoryException(string message, Exception innerException) | ||
| 131 | : base(message, innerException) | ||
| 132 | { | ||
| 133 | } | ||
| 134 | |||
| 135 | /// <summary> | ||
| 136 | /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class. | ||
| 137 | /// </summary> | ||
| 138 | /// <param name="info">Serialization information for this exception</param> | ||
| 139 | /// <param name="context">Streaming context to serialize to</param> | ||
| 140 | protected InvalidBootstrapperApplicationFactoryException(SerializationInfo info, StreamingContext context) | ||
| 141 | : base(info, context) | ||
| 142 | { | ||
| 143 | } | ||
| 144 | } | ||
| 145 | } | ||
