Skip to content

Commit 963a39f

Browse files
Jabenclaude
andcommitted
Add comprehensive XML documentation to exception types
Completes Phase 8 by documenting the GotenbergApiException class for proper error handling guidance. Documented class: - GotenbergApiException: Complete class, constructor, properties, and methods documentation Key improvements: - Explained when exception is thrown (Gotenberg error responses) - Documented all properties (StatusCode, RequestUri, ReasonPhrase) - Documented ToVerboseJson() for detailed error logging - Added parameter descriptions for ToVerboseJson options - Clarified exception contains both request and response details Users now have complete information for implementing error handling and logging in their applications. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d065574 commit 963a39f

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

src/Gotenberg.Sharp.Api.Client/Infrastructure/GotenbergApiException.cs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,25 @@
1818
using Gotenberg.Sharp.API.Client.Domain.Requests.ApiRequests;
1919

2020
// ReSharper disable All CA1032
21-
// ReSharper disable All CA1822
21+
// ReSharper disable All CA1822
2222
namespace Gotenberg.Sharp.API.Client.Infrastructure
2323
{
24-
/// <inheritdoc />
24+
/// <summary>
25+
/// Exception thrown when Gotenberg returns an error response.
26+
/// Contains detailed information about the failed request including status code, request URI, and error message from Gotenberg.
27+
/// </summary>
2528
public sealed class GotenbergApiException : Exception
2629
{
2730
readonly IApiRequest _request;
2831

2932
readonly HttpResponseMessage _response;
3033

34+
/// <summary>
35+
/// Initializes a new instance of GotenbergApiException.
36+
/// </summary>
37+
/// <param name="message">Error message from Gotenberg.</param>
38+
/// <param name="request">The request that failed.</param>
39+
/// <param name="response">The HTTP response containing the error.</param>
3140
public GotenbergApiException(
3241
string message,
3342
IApiRequest request,
@@ -41,12 +50,27 @@ public GotenbergApiException(
4150
this.ReasonPhrase = _response.ReasonPhrase;
4251
}
4352

53+
/// <summary>
54+
/// Gets the HTTP status code returned by Gotenberg.
55+
/// </summary>
4456
public HttpStatusCode StatusCode { get; }
4557

58+
/// <summary>
59+
/// Gets the URI of the failed request.
60+
/// </summary>
4661
public Uri? RequestUri { get; }
4762

63+
/// <summary>
64+
/// Gets the HTTP reason phrase from the error response.
65+
/// </summary>
4866
public string? ReasonPhrase { get; }
4967

68+
/// <summary>
69+
/// Creates a GotenbergApiException from a failed HTTP response.
70+
/// </summary>
71+
/// <param name="request">The request that failed.</param>
72+
/// <param name="response">The HTTP response containing the error.</param>
73+
/// <returns>A new GotenbergApiException with error details.</returns>
5074
public static GotenbergApiException Create(
5175
IApiRequest request,
5276
HttpResponseMessage response)
@@ -55,6 +79,13 @@ public static GotenbergApiException Create(
5579
return new GotenbergApiException(message, request, response);
5680
}
5781

82+
/// <summary>
83+
/// Generates a detailed JSON representation of the exception for debugging and logging.
84+
/// </summary>
85+
/// <param name="includeGotenbergResponse">Include the full Gotenberg HTTP response. Default: true.</param>
86+
/// <param name="includeRequestContent">Include the request content that was sent. Default: true.</param>
87+
/// <param name="indentJson">Format the JSON with indentation for readability. Default: false.</param>
88+
/// <returns>JSON string containing detailed error information.</returns>
5889
public string ToVerboseJson(
5990
bool includeGotenbergResponse = true,
6091
bool includeRequestContent = true,

0 commit comments

Comments
 (0)