Skip to content

Improve the error output#148

Open
ric394 wants to merge 2 commits into
masterfrom
ImproveFailureMessages
Open

Improve the error output#148
ric394 wants to merge 2 commits into
masterfrom
ImproveFailureMessages

Conversation

@ric394

@ric394 ric394 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

resolves #147

This adds the offending URL to error outputs and removes the full html plain text output in favour of the body text only.

Copilot AI review requested due to automatic review settings June 5, 2026 05:46
@ric394 ric394 added the ready for software review Means a PR is ready for software team review label Jun 5, 2026
@ric394 ric394 requested a review from par456 June 5, 2026 05:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses issue #147 by improving HTTP error outputs produced by APSIM.POStats.Shared.WebUtilities, aiming to include the offending URL in error messages and reduce noisy HTML output.

Changes:

  • Include the request method and URL in thrown/printed error messages when requests fail.
  • Attempt to reduce HTML noise by extracting the <body> portion of HTML responses before logging/returning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread APSIM.POStats.Shared/WebUtilities.cs
Comment on lines 63 to +67
output += $"Request:\n{response}\n";
output += $"Response:\n{body}\n";

Console.WriteLine($"Error sending POST Request\n{output}");
throw new Exception($"Error sending POST Request\n{output}");
Console.WriteLine($"Error sending {type} for URL {requestUrl} Request\n{output}");
throw new Exception($"Error sending {type} for URL {requestUrl} Request\n{output}");
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for software review Means a PR is ready for software team review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error messages need more info and better formatting

2 participants