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

Actual exception is hidden when doing must.throw('bla bla') #4

Open
koresar opened this issue Dec 10, 2013 · 6 comments
Open

Actual exception is hidden when doing must.throw('bla bla') #4

koresar opened this issue Dec 10, 2013 · 6 comments

Comments

@koresar
Copy link

koresar commented Dec 10, 2013

My assertion looks like this:

myObject.myFunction.must.throw(/the text I expect/);

If myFunction throws a different exception
(like TypeError: Cannot read property 'myProperty' of null)
the must.js hides it from me.

It would be beneficial to see the actual exception stack trace while debugging a test.

@moll
Copy link
Owner

moll commented Dec 10, 2013

Hey!

Thanks for pointing this out and nudging me to do something about it! I've been annoyed by this too recently — just haven't dealt with it. :-)

I'll have to figure something out which would work well with test runners.

@moll
Copy link
Owner

moll commented Jun 14, 2015

I've actually ended up doing a try-catch myself in tests to have more fine grained assertions on errors.
I'm still not particularly sure how to get test runners to print out nested exceptions like this.

var err
try { something() } catch (ex) { err = ex }
err.must.be.an.instanceof(Error)
err.code.must.equal(404)

Do you have any suggestions or should we just close this issue until we come up with a better idea?

Thanks!

@koresar
Copy link
Author

koresar commented Jun 14, 2015

Do whatever you think is reasonable, mate. :) As I'm not using your module. Sorry.

@moll
Copy link
Owner

moll commented Jun 14, 2015

Fair enough. Do check out the latest Promise support if you're into that sort of thing. ^_^
I'll close this issue for now until further ideas arise. Still, thanks!

@moll moll closed this as completed Jun 14, 2015
@moll
Copy link
Owner

moll commented Jun 15, 2015

Oh, I actually noticed you did propose a solution in https://github.com/moll/js-must/pull/7/files. Thanks!

@moll moll reopened this Jun 15, 2015
@koresar
Copy link
Author

koresar commented Jun 15, 2015

Ha, I forgot. Sorry. :-)

On Mon, 15 Jun 2015 18:45 Andri Möll [email protected] wrote:

Oh, I actually noticed you did propose a solution in
https://github.com/moll/js-must/pull/7/files. Thanks!


Reply to this email directly or view it on GitHub
#4 (comment).

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

No branches or pull requests

2 participants