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

async: extract_exn #278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

async: extract_exn #278

wants to merge 1 commit into from

Conversation

vbmithr
Copy link
Member

@vbmithr vbmithr commented Sep 11, 2020

This is need in order for the Async version to work properly.
Without it, try_with with not return the exception raised by user, but instead an exception wrapper which does not play nice with testing.

@craigfe
Copy link
Member

craigfe commented Sep 11, 2020

Not being familiar with Async, my understanding is that extract_exn:true discards some backtrace and monitor information that might be helpful for debugging. In what sense does the exception wrapper not play nicely with testing?

@vbmithr
Copy link
Member Author

vbmithr commented Sep 12, 2020

In the sense that alcotest (apparently) uses exceptions when failing tests and uses the exception to display the problem (i.e. the function returned x instead of y in the case of an int function being tested). If not using extract_exn:true, this information is lost and you just see an unhelpful general exception.

@craigfe
Copy link
Member

craigfe commented Sep 12, 2020

Added a test case for this in #279.

It's true that Async's exception wrapping prevents exceptions raised by Alcotest.check from being properly displayed at the top-level, and adding extract_exn:true fixes this behaviour. Unfortunately, this also throws away stack trace information from user exceptions in tests (example).

I think a more granular solution is necessary to ensure that only Check_error exceptions are unwrapped in this way.

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