Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom error message for StorageNoopGuard #1727

Merged
merged 13 commits into from
Sep 27, 2023
Prev Previous commit
Next Next commit
Remove From implementation
  • Loading branch information
seadanda committed Sep 27, 2023
commit 7bc5b6157c19d2cfa7838cfefbecdb165ad2ae88
16 changes: 0 additions & 16 deletions substrate/frame/support/src/storage/storage_noop_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ impl Default for StorageNoopGuard {
}
}

impl From<&'static str> for StorageNoopGuard {
fn from(error_message: &'static str) -> Self {
StorageNoopGuard { storage_root: sp_std::vec::Vec::new(), error_message }
}
}

impl StorageNoopGuard {
/// Alias to `default()`.
pub fn new() -> Self {
Expand Down Expand Up @@ -153,16 +147,6 @@ mod tests {
});
}

#[test]
#[should_panic(expected = "`StorageNoopGuard` found unexpected storage changes.")]
fn storage_noop_guard_panics_created_from() {
TestExternalities::default().execute_with(|| {
let _guard =
StorageNoopGuard::from("`StorageNoopGuard` found unexpected storage changes.");
frame_support::storage::unhashed::put(b"key", b"value");
});
}

#[test]
#[should_panic(expected = "`StorageNoopGuard` found unexpected storage changes.")]
fn storage_noop_guard_panics_with_set_error_message() {
Expand Down