-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Optimization
]: add exception message to ArgumentException
#3862
Merged
shargon
merged 2 commits into
neo-project:master
from
Wi1l-B0t:style.add-info-to-ArugmentException
Apr 1, 2025
Merged
[Optimization
]: add exception message to ArgumentException
#3862
shargon
merged 2 commits into
neo-project:master
from
Wi1l-B0t:style.add-info-to-ArugmentException
Apr 1, 2025
+74
−41
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Optimization
]: add exception message to ArgumentException
Optimization
]: add exception message to ArgumentException
467e025
to
c18716b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves exception handling by replacing generic ArgumentExceptions with more descriptive messages for better clarity and debugging. Key changes include:
- Adding detailed exception messages to various methods across tests and production code.
- Refactoring null-checks by using ArgumentNullException.ThrowIfNull with parameter names.
- Improving code formatting and inline exception messages for consistency and readability.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/Neo.UnitTests/Ledger/UT_PoolItem.cs | Added descriptive exception message on size mismatch. |
tests/Neo.UnitTests/Cryptography/UT_MerkleTree.cs | Renamed parameter and replaced null-check with ThrowIfNull. |
src/Plugins/TokensTracker/Trackers/TokenTransferKey.cs | Updated null-checks to use ThrowIfNull with parameter names. |
src/Plugins/TokensTracker/Trackers/NEP-17/Nep17BalanceKey.cs | Refactored ctor and argument-checks for clarity. |
src/Plugins/TokensTracker/Trackers/NEP-11/Nep11BalanceKey.cs | Replaced generic null-check with parameter specific checks. |
src/Plugins/SQLiteWallet/SQLiteWallet.cs | Enhanced exception messages with parameter details. |
src/Neo/Wallets/Helper.cs | Added detailed exception message for XOR length mismatch. |
src/Neo/SmartContract/Native/OracleContract.cs | Improved formatting and enhanced exception message clarity in Request method. |
src/Neo/SmartContract/Native/ContractManagement.cs | Added descriptive exception messages when both parameters are null and on update limits. |
src/Neo/SmartContract/ContractParameter.cs | Provided a clear error message for unsupported ContractParameterType. |
src/Neo/SmartContract/ApplicationEngine.Crypto.cs | Detailed exception messages for CheckMultisig parameter checks. |
src/Neo.ConsoleService/CommandToken.cs | Exception messages refined to indicate unmatched quote/space. |
Jim8y
previously approved these changes
Apr 1, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Jim8y
approved these changes
Apr 1, 2025
shargon
approved these changes
Apr 1, 2025
Jim8y
added a commit
to Jim8y/neo
that referenced
this pull request
Apr 9, 2025
* master: (163 commits) [style] Added some var styles (neo-project#3867) [`fix`] stop syncing on block 1465790 (neo-project#3888) Optimize block deserialization (neo-project#3879) Avoid double `ToArray` on `OnInvMessageReceived` (neo-project#3875) style: format long lines (neo-project#3884) optimize: return GetFileNameWithoutExtension(Path) if name is not set (neo-project#3883) Fix possible null exception (neo-project#3880) Remove linkedList (neo-project#3873) Optimize Uint160 and Uint256 constructor (neo-project#3872) Release the resources (neo-project#3868) [Clean] Remove `IRawReadOnlyStore` (neo-project#3869) move non-plugins out of plugins (neo-project#3863) feature: set name when create wallet (neo-project#3866) Native: swap Policy's `[get/set]AttributeFee` implementations (neo-project#3859) Fix: concurrent conflict in Cache.CopyTo (neo-project#3860) Fix: add default key parameter in help cmd (neo-project#3865) [Plugin UT] add more rpcserver UTs (neo-project#3864) config: upgrade NeoFS chains protocol configuration (neo-project#3858) [`Optimization`]: add exception message to `ArgumentException` (neo-project#3862) Native: unify arguments naming of CryptoLib's `verifyWith*` methods (neo-project#3855) ... # Conflicts: # benchmarks/Neo.VM.Benchmarks/OpCode/Arrays/OpCode.ReverseN.cs # benchmarks/Neo.VM.Benchmarks/Program.cs # src/Neo/Neo.csproj # src/Neo/ProtocolSettings.cs # src/Neo/SmartContract/ApplicationEngine.cs # src/Neo/SmartContract/Native/NeoToken.cs # src/Neo/SmartContract/Native/RoleManagement.cs # tests/Neo.UnitTests/SmartContract/Manifest/UT_ContractManifest.cs # tests/Neo.UnitTests/SmartContract/Manifest/UT_ContractPermission.cs # tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs # tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs # tests/Neo.UnitTests/UT_ProtocolSettings.cs # tests/Neo.VM.Tests/UT_ReferenceCounter.cs
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add message when
throw new ArgumentException
Type of change
Checklist: