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

Deprecate name and message options of assert and ensure #125

Open
lambdalisue opened this issue Aug 13, 2024 · 1 comment
Open

Deprecate name and message options of assert and ensure #125

lambdalisue opened this issue Aug 13, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@lambdalisue
Copy link
Member

lambdalisue commented Aug 13, 2024

If @core/errorutil offers error alteration functions as proposed in jsr-core/errorutil#3, I believe we can deprecate the name and message options in assert and ensure.

I'd like to deprecate these options due to issue #121. Additionally, I'd like to deprecate setAssertMessageFactory (and its related functions) to simplify the overall implementation.

Before proceeding, I'd like to gauge how many users currently rely on these functionalities and whether they are open to migrating their code to the solution mentioned in the issue.

@lambdalisue lambdalisue added enhancement New feature or request breaking labels Aug 13, 2024
@lambdalisue lambdalisue added this to the v5 milestone Aug 21, 2024
@lambdalisue lambdalisue changed the title RFC: Deprecate name and message options of assert and ensure? Deprecate name and message options of assert and ensure Aug 21, 2024
@lambdalisue
Copy link
Member Author

import { assert, is } from "@core/unknownutil";
import { alter } from "@core/errorutil";

const v: unknown = "";

alter(() => assert(v, is.Number), new TypeError("v must be number"));
// TypeError instead of AssertError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant