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 requireFail. Like fail(), but it also always throws an error #1163

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

younata
Copy link
Member

@younata younata commented Oct 11, 2024

Fixes #1161

The PR should summarize what was changed and why. Here are some questions to
help you if you're not sure:

  • What behavior was changed?
  • What code was refactored / updated to support this change?
  • What issues are related to this PR? Or why was this change introduced?

Checklist - While not every PR needs it, new features should consider this list:

  • Does this have tests?
  • Does this have documentation?
  • Does this break the public API (Requires major version bump)?
  • Is this a new feature (Requires minor version bump)?

@younata younata merged commit 61dcf0c into main Oct 11, 2024
12 of 16 checks passed
@younata younata deleted the require_fail branch October 11, 2024 13:53
noamfreeman pushed a commit to noamfreeman/Nimble that referenced this pull request Oct 14, 2024
///
/// - Parameter message: A custom message to use in place of the default one.
/// - Parameter customError: A custom error to throw in place of a ``RequireError``.
public func requireFail(_ message: String? = nil, customError: Error? = nil, fileID: String = #fileID, filePath: FileString = #filePath, line: UInt = #line, column: UInt = #column) throws {
Copy link

@noamfreeman noamfreeman Nov 27, 2024

Choose a reason for hiding this comment

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

is it reasonable to return Never from this function?
otherwise the usage is a bit weird, since the caller needs to somehow return or fatal error after it.

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.

Suggestion: throwing counterpart to fail(message
2 participants