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 ensure_cdk macro for validation checks #629

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

ok300
Copy link
Contributor

@ok300 ok300 commented Mar 5, 2025

Description

This PR brings the ensure_cdk macro, which is similar to anyhow::ensure.

It lets us replace validation steps like

if !flag {
  return Err(CustomError::Type);
}

with

ensure_cdk!(flag, CustomError::Type);

which helps make with code more readable and maintainable.


Suggested CHANGELOG Updates

CHANGED

ADDED

  • Improve code readability: introduce ensure_cdk

REMOVED

FIXED


Checklist

Copy link
Collaborator

@thesimplekid thesimplekid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

@thesimplekid thesimplekid merged commit a394145 into cashubtc:main Mar 6, 2025
63 checks passed
@ok300 ok300 deleted the ok300-ensure-cdk branch March 9, 2025 15:49
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.

2 participants