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

A function to just raise an exception. #463

Closed
wants to merge 1 commit into from
Closed

A function to just raise an exception. #463

wants to merge 1 commit into from

Conversation

uriva
Copy link

@uriva uriva commented Sep 5, 2019

This is because you can't easily use a lambda to raise an exception, and sometimes the need arises to translate an exception X into exception Y when using toolz.excepts.

This is because you can't easily use a lambda to raise an exception, and sometimes the need arises to translate an exception X into exception Y when using `toolz.excepts`.
@mentalisttraceur
Copy link

mentalisttraceur commented Feb 13, 2023

If this doesn't get merged and you want something like this:

  1. funcy has a raiser function which does the same thing as your just_raise in this PR, and can also pass arguments if constructing a new exception instance.

  2. My raise provides a minimal implementation of raise as a function. I regularly do lambda ...: raise_(...), and you can make your just_raise from it: just_raise = partial(partial, raise_).

@uriva
Copy link
Author

uriva commented Feb 15, 2023

this is quite old, i've implemented this already in https://github.com/hyroai/gamla

@uriva uriva closed this Feb 15, 2023
@mentalisttraceur
Copy link

Oh haha I recognize that library name. We had a similar talk in #472 .

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