Skip to content

refactor: add require! macro for consistent revert messages - #130

Open
MarcusDavidG wants to merge 1 commit into
mainfrom
refactor/require-macro
Open

refactor: add require! macro for consistent revert messages#130
MarcusDavidG wants to merge 1 commit into
mainfrom
refactor/require-macro

Conversation

@MarcusDavidG

Copy link
Copy Markdown
Contributor

Introduces a require!(cond, msg) macro (mirrors Solidity's require) that wraps assert! with a string literal message.

Why

  • Raw assert! messages are already strings, but require! signals intent clearly
  • Panic messages surface in transaction error metadata and test #[should_panic(expected = ...)] annotations
  • Establishes a consistent pattern for all subsequent feature PRs

Changes

  • require! macro defined in lib.rs before first use
  • require_not_paused updated to use require!

Closes #123

Introduces a require!(cond, msg) macro that wraps assert! with a
literal message. Replaces the raw assert! in require_not_paused
and establishes the pattern used throughout subsequent feature PRs.

Panic messages are visible in transaction error metadata and test
output, improving debuggability.

Closes #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: replace assert! with require! macro pattern for consistent revert messages

1 participant