Add custom error message for StorageNoopGuard#1727
Conversation
Turn StorageNoopGuard into struct with storage_root and error_message. Add from_error_message constructor. Add set_error_message setter.
liamaharon
left a comment
There was a problem hiding this comment.
Looking good, left some comments.
Also, I think we should also add something like
impl From<&'static str> for StorageNoopGuard {
fn from(s: &'static str) -> Self {
StorageNoopGuard {
storage_root: sp_std::vec::Vec::new(),
error_message: s,
}
}
}Co-authored-by: joe petrowski <[email protected]>
Great, seems like a nice addition. I'll add it in. |
Co-authored-by: Liam Aharon <[email protected]>
liamaharon
left a comment
There was a problem hiding this comment.
LGTM once impl From<&'static str> for StorageNoopGuard is added
Since this is for testing it doesn't need to be optimised unnecessarily
|
OK to summarise for all reviewers:
I hope everybody is happy with the changes I've gone with. Thanks for the very helpful reviews :) |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
* tsv-disabling-node-side: (69 commits) runtime-api: cleanup after v7 stabilization (#1729) Move requests-responses and polling from `ChainSync` to `SyncingEngine` (#1650) Add custom error message for `StorageNoopGuard` (#1727) Clarify docs cargo fmt add a CAVEAT comment implement disabled_validators correctly remove unnecessary hash string (#1722) OpenGov in Westend and Rococo (#1177) Associated type Hasher for `QueryPreimage`, `StorePreimage` and `Bounded` (#1720) Migrate polkadot-primitives to v6 (#1543) genesis-builder: implemented for all runtimes (#1492) `BlockId` removal: `tx-pool` refactor (#1678) Bump directories from 4.0.1 to 5.0.1 (#1656) Allow debug_assertions in short-benchmarks CI job (#1711) chainHead/storage: Fix storage iteration using the query key (#1665) Implement more useful traits in `Slot` type (#1595) Make downloads in parallel and give more time to complete (#1699) Bump actions/checkout from 4.0.0 to 4.1.0 (#1688) contracts: Fix incorrect storage alias in mirgration (#1687) ...
Expand `StorageNoopGuard` to be able to add extra context through a custom error message. When the guard is triggered it panics with an error message which can be defaulted, set on construction, or set after it has been constructed. Turn `StorageNoopGuard` into struct with `storage_root` and `error_message` and added `from_error_message` constructor and `set_error_message` setter. Also added `new()` aliased to `default()`. Closes paritytech#375 --------- Co-authored-by: joe petrowski <[email protected]> Co-authored-by: Liam Aharon <[email protected]>
Expand
StorageNoopGuardto be able to add extra context through a custom error message. When the guard is triggered it panics with an error message which can be defaulted, set on construction, or set after it has been constructed.Turn
StorageNoopGuardinto struct withstorage_rootanderror_messageand addedfrom_error_messageconstructor andset_error_messagesetter.Also added
new()aliased todefault().Closes #375