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

toThrow(message) doesn't check the Error message #332

Open
Y-- opened this issue Feb 26, 2021 · 4 comments
Open

toThrow(message) doesn't check the Error message #332

Y-- opened this issue Feb 26, 2021 · 4 comments
Assignees
Labels
Enhancement 🌴 New feature or request

Comments

@Y--
Copy link

Y-- commented Feb 26, 2021

Hi!

Thanks for this great project!

I'm following up with the discussion here ColinEberhardt/assemblyscript-regex#35 where I was a bit surprised to realized that the toThrow assertion doesn't check the error message (only that something is actually thrown).
Looking at the code my understanding is that the message sent to toThrow is used only when the assertion fails.

Would that make sense to change the API and have the thrown message be checked?
(maybe with an "include" at first since RegExp are not natively implemented in AS?)
Happy to work on a PR if that makes sense.

Thanks!

@jtenner
Copy link
Contributor

jtenner commented Feb 27, 2021

@Y-- Actually, I think this would be a great addition to as-pect. I forgot I could check the abort assertion message and compare it to a string...

@willemneal What do you think?

@willemneal
Copy link
Collaborator

Sounds great!

@jtenner
Copy link
Contributor

jtenner commented Feb 27, 2021

I will need some time to figure out a reasonable way to implement this. Thanks for the feature request.

@jtenner jtenner added the Enhancement 🌴 New feature or request label Mar 1, 2021
@jtenner jtenner self-assigned this Mar 1, 2021
@Thykof
Copy link

Thykof commented Apr 9, 2024

Hi @jtenner here I tried to implement but couldn't make it work :/ Thykof#1

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

4 participants