|
3 | 3 | * PROJECT: FileHandler |
4 | 4 | * FILE: FileHandler/FileHandlerException.cs |
5 | 5 | * PURPOSE: Exception Class |
6 | | - * PROGRAMER: Peter Geinitz (Wayfarer) |
7 | | - * SOURCES: https://msdn.microsoft.com/en-us/library/system.exception.getobjectdata.aspx |
| 6 | + * PROGRAMMER: Peter Geinitz (Wayfarer) |
8 | 7 | */ |
9 | 8 |
|
10 | 9 | using System; |
11 | | -using System.Runtime.Serialization; |
12 | 10 |
|
13 | | -namespace FileHandler; |
14 | | - |
15 | | -/// <inheritdoc /> |
16 | | -/// <summary> |
17 | | -/// The file handler exception class. |
18 | | -/// </summary> |
19 | | -/// <seealso cref="T:System.Exception" /> |
20 | | -[Serializable] |
21 | | -public sealed class FileHandlerException : Exception |
| 11 | +namespace FileHandler |
22 | 12 | { |
23 | | - /// <inheritdoc /> |
24 | 13 | /// <summary> |
25 | | - /// Initializes a new instance of the <see cref="T:FileHandler.FileHandlerException" /> class. |
| 14 | + /// Represents errors that occur within the <c>FileHandler</c> library. |
26 | 15 | /// </summary> |
27 | | - /// <param name="message">The message.</param> |
28 | | - internal FileHandlerException(string message) : base(message) |
| 16 | + /// <remarks> |
| 17 | + /// This exception is thrown for library-specific errors, providing a consistent type |
| 18 | + /// for users to catch and handle separately from standard .NET exceptions. |
| 19 | + /// </remarks> |
| 20 | + public sealed class FileHandlerException : Exception |
29 | 21 | { |
30 | | - } |
| 22 | + /// <summary> |
| 23 | + /// Gets the path of the file associated with this exception, if any. |
| 24 | + /// </summary> |
| 25 | + public string? FilePath { get; } |
31 | 26 |
|
32 | | - /// <inheritdoc /> |
33 | | - /// <summary> |
34 | | - /// Initializes a new instance of the <see cref="T:FileHandler.FileHandlerException" /> class. |
35 | | - /// </summary> |
36 | | - /// <param name="info">The info.</param> |
37 | | - /// <param name="context">The context.</param> |
38 | | - private FileHandlerException(SerializationInfo info, StreamingContext context) : base(info, context) |
39 | | - { |
40 | | - } |
| 27 | + /// <summary> |
| 28 | + /// Initializes a new instance of the <see cref="FileHandlerException"/> class. |
| 29 | + /// </summary> |
| 30 | + public FileHandlerException() |
| 31 | + { |
| 32 | + } |
41 | 33 |
|
42 | | - /// <inheritdoc /> |
43 | | - /// <summary> |
44 | | - /// Initializes a new instance of the <see cref="T:FileHandler.FileHandlerException" /> class. |
45 | | - /// </summary> |
46 | | - public FileHandlerException() |
47 | | - { |
48 | | - } |
| 34 | + /// <summary> |
| 35 | + /// Initializes a new instance of the <see cref="FileHandlerException"/> class with a specified error message. |
| 36 | + /// </summary> |
| 37 | + /// <param name="message">The message describing the error.</param> |
| 38 | + public FileHandlerException(string message) |
| 39 | + : base(message) |
| 40 | + { |
| 41 | + } |
49 | 42 |
|
50 | | - /// <inheritdoc /> |
51 | | - /// <summary> |
52 | | - /// Initializes a new instance of the <see cref="T:FileHandler.FileHandlerException" /> class. |
53 | | - /// </summary> |
54 | | - /// <param name="message">The message we declarte</param> |
55 | | - /// <param name="innerException"> |
56 | | - /// The Exception that caused the Exception or a null reference <see langword="Nothing" /> in |
57 | | - /// Visual Basic), if there is no inner Exception. |
58 | | - /// </param> |
59 | | - public FileHandlerException(string message, Exception innerException) : base(message, innerException) |
60 | | - { |
| 43 | + /// <summary> |
| 44 | + /// Initializes a new instance of the <see cref="FileHandlerException"/> class with a specified |
| 45 | + /// error message and a reference to the inner exception that caused this exception. |
| 46 | + /// </summary> |
| 47 | + /// <param name="message">The message describing the error.</param> |
| 48 | + /// <param name="innerException">The exception that caused the current exception.</param> |
| 49 | + public FileHandlerException(string message, Exception innerException) |
| 50 | + : base(message, innerException) |
| 51 | + { |
| 52 | + } |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// Initializes a new instance of the <see cref="FileHandlerException"/> class with a specified |
| 56 | + /// error message and an associated file path. |
| 57 | + /// </summary> |
| 58 | + /// <param name="message">The message describing the error.</param> |
| 59 | + /// <param name="filePath">The file path related to the error.</param> |
| 60 | + public FileHandlerException(string message, string filePath) |
| 61 | + : base(message) |
| 62 | + { |
| 63 | + FilePath = filePath; |
| 64 | + } |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// Initializes a new instance of the <see cref="FileHandlerException"/> class with a specified |
| 68 | + /// error message, associated file path, and a reference to the inner exception that caused this exception. |
| 69 | + /// </summary> |
| 70 | + /// <param name="message">The message describing the error.</param> |
| 71 | + /// <param name="filePath">The file path related to the error.</param> |
| 72 | + /// <param name="innerException">The exception that caused the current exception.</param> |
| 73 | + public FileHandlerException(string message, string filePath, Exception innerException) |
| 74 | + : base(message, innerException) |
| 75 | + { |
| 76 | + FilePath = filePath; |
| 77 | + } |
61 | 78 | } |
62 | 79 | } |
0 commit comments