Introduce InvalidMethodParametersException to handle cases where inva…#73
Conversation
…lid parameters are provided to WMI methods.
…cuteMethod overloads in WmiConnection.cs to clarify that these methods may throw this exception when WMI method parameters are invalid.
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new custom exception type InvalidMethodParametersException to provide better error handling when invalid parameters are passed to WMI methods. The change improves error diagnostics by catching the specific WBEM_E_INVALID_METHOD_PARAMETERS HRESULT and wrapping it in a more descriptive exception.
Key changes:
- Created a new
InvalidMethodParametersExceptionclass that extendsWmiException - Updated
WbemServices.ExecuteMethodto catch and throw this specific exception - Added XML documentation for the new exception across all
ExecuteMethodoverloads inWmiConnection
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| WmiLight/Exceptions/InvalidMethodParametersException.cs | New exception class for handling invalid WMI method parameters with descriptive error message |
| WmiLight/Wbem/WbemServices.cs | Updated exception handling to detect and throw InvalidMethodParametersException when parameters are invalid |
| WmiLight/WmiConnection.cs | Added XML documentation for the new exception across all 8 ExecuteMethod method overloads |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…names, and its message includes both for improved context.
…ts usages with InvalidParameterException.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lid parameters are provided to WMI methods.