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

ensure abort() is passed an Exception #722

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

Conversation

winmillwill
Copy link

Apparently, Exception#cause does nothing to ensure that there is actually an
inner or original Exception instance, and this leads to an unhelpful error
message about expecting String and getting Nil when rescue in
ChefMutex#synchronize() finally calls abort().

In my case, the error I needed was that the constraints in the environment
were untenable because I hadn't run berks upload.

I tried to write a spec for this, but wasn't able to assert that the mutex
should receive abort and that the argument should be a RuntimeError with
message 'foo'. It would either barf on me for having an error, hang, or never
receive any calls to abort.

Apparently, Exception#cause does nothing to ensure that there is actually
an inner or original Exception instance, and this leads to an unhelpful
error message about expecting String and getting Nil when rescue in
`ChefMutex#synchronize()` finally calls `abort()`.

In my case, the error I needed was that the constraints in the environment
were untenable because I hadn't run `berks upload`.

I tried to write a spec for this, but wasn't able to assert that the mutex
should receive abort and that the argument should be a RuntimeError with
message 'foo'. It would either barf on me for having an error, hang, or
never receive any calls to abort.
@KAllan357
Copy link
Contributor

Nice catch, thanks for this! 👍 from me.

@slantview
Copy link
Contributor

This looks good, 👍

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.

3 participants