Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Computer.V2.Lib/Maths.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.RegularExpressions;
using System;
using System.Text.RegularExpressions;
using Computer.V2.Lib.Exceptions;

namespace Computer.V2.Lib
Expand Down Expand Up @@ -57,8 +58,9 @@ private static void Pow(ref string expression)
//prevent exponential notation to a degree, to big of a number will have a result of infinity;
expression = expression.Replace(match, res.ToString("0." + new string('#', 9999)));
}
catch(System.FormatException)
catch(Exception)
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

Consider catching a more specific exception (e.g., FormatException) instead of Exception to avoid masking unexpected errors.

Suggested change
catch(Exception)
catch(System.FormatException)

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI May 30, 2025

Choose a reason for hiding this comment

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

Catching a generic Exception may obscure specific errors; consider catching FormatException or a more specific exception to ensure that the error message accurately reflects the issue.

Suggested change
catch(Exception)
catch(FormatException)

Copilot uses AI. Check for mistakes.
{
// test comment
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

[nitpick] Remove or update the placeholder comment 'test comment' to provide more meaningful context or remove if unnecessary.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI May 30, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment 'test comment' appears to be leftover debugging text; consider removing or replacing it with a more informative comment that explains the rationale behind the error handling.

Copilot uses AI. Check for mistakes.
throw new InvalidExpressionException("Power is of wrong format");
}
}
Expand Down
Loading